lang: ast, core: fmt: Allow unification variables for fmt
This lets us pass through unification variables into the fmt function. I hope this doesn't break anything, but it's worth trying for now.
This commit is contained in:
@@ -8307,6 +8307,7 @@ func (obj *ExprCall) getPartials(fn *ExprFunc) (*types.Type, []types.Value, erro
|
|||||||
|
|
||||||
// optimization: if type/value is already known, specify it now!
|
// optimization: if type/value is already known, specify it now!
|
||||||
var err1, err2 error
|
var err1, err2 error
|
||||||
|
// NOTE: This _can_ return unification variables now. Is it ok?
|
||||||
mapped[name], err1 = arg.Type() // nil type on error
|
mapped[name], err1 = arg.Type() // nil type on error
|
||||||
partialValues[i], err2 = arg.Value() // nil value on error
|
partialValues[i], err2 = arg.Value() // nil value on error
|
||||||
if err1 == nil && err2 == nil && mapped[name].Cmp(partialValues[i].Type()) != nil {
|
if err1 == nil && err2 == nil && mapped[name].Cmp(partialValues[i].Type()) != nil {
|
||||||
|
|||||||
@@ -175,11 +175,11 @@ func (obj *PrintfFunc) FuncInfer(partialType *types.Type, partialValues []types.
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assume x does not contain unification variables!
|
// NOTE: Is it okay to allow unification variables here?
|
||||||
if x.HasUni() {
|
//if x.HasUni() {
|
||||||
// programming error (did the compiler change?)
|
// // programming error (did the compiler change?)
|
||||||
return nil, nil, fmt.Errorf("programming error at arg index %d", i)
|
// return nil, nil, fmt.Errorf("programming error at arg index %d", i)
|
||||||
}
|
//}
|
||||||
if err := unificationUtil.UnifyCmp(x, formatList[i-1]); err != nil {
|
if err := unificationUtil.UnifyCmp(x, formatList[i-1]); err != nil {
|
||||||
return nil, nil, errwrap.Wrapf(err, "inconsistent type at arg index %d", i)
|
return nil, nil, errwrap.Wrapf(err, "inconsistent type at arg index %d", i)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user