interp: improve type assertions
In type assertion at compile time, compare signatures between function types only. Make `itype.numOut()` return the correct value for Go builtins (this was not strictly necessary due to above fix, but it is correct and improves maintainability). Fixes #1454.
This commit is contained in:
@@ -1249,8 +1249,13 @@ func (t *itype) numOut() int {
|
||||
if t.rtype.Kind() == reflect.Func {
|
||||
return t.rtype.NumOut()
|
||||
}
|
||||
case builtinT:
|
||||
switch t.name {
|
||||
case "append", "cap", "complex", "copy", "imag", "len", "make", "new", "real", "recover":
|
||||
return 1
|
||||
}
|
||||
}
|
||||
return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
func (t *itype) out(i int) *itype {
|
||||
|
||||
Reference in New Issue
Block a user