lang: ast, core: fmt: Catch invalid nil signatures
We accidentally had a bad error triggered.
This commit is contained in:
@@ -8474,6 +8474,10 @@ func (obj *ExprCall) Infer() (*types.Type, []*interfaces.UnificationInvariant, e
|
|||||||
return nil, nil, errwrap.Wrapf(err, "func `%s` infer error", exprFunc.Title)
|
return nil, nil, errwrap.Wrapf(err, "func `%s` infer error", exprFunc.Title)
|
||||||
}
|
}
|
||||||
invariants = append(invariants, invars...)
|
invariants = append(invariants, invars...)
|
||||||
|
if typ == nil { // should get a sig, not a nil!
|
||||||
|
// programming error
|
||||||
|
return nil, nil, fmt.Errorf("func `%s` infer type was nil", exprFunc.Title)
|
||||||
|
}
|
||||||
|
|
||||||
// It's important that we copy the type signature here.
|
// It's important that we copy the type signature here.
|
||||||
// See the above comment which explains the reasoning.
|
// See the above comment which explains the reasoning.
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ func (obj *PrintfFunc) FuncInfer(partialType *types.Type, partialValues []types.
|
|||||||
// Assume x does not contain unification variables!
|
// Assume x does not contain unification variables!
|
||||||
if x.HasUni() {
|
if x.HasUni() {
|
||||||
// programming error (did the compiler change?)
|
// programming error (did the compiler change?)
|
||||||
return nil, nil, errwrap.Wrapf(err, "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