traefik / yaegi

Yaegi is Another Elegant Go Interpreter
https://pkg.go.dev/github.com/traefik/yaegi
Apache License 2.0
7.1k stars 351 forks source link

interp: improve type assertions #1455

Closed mvertes closed 2 years ago

mvertes commented 2 years ago

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.

mvertes commented 2 years ago

Yes, I went for the shortest fix. The issue here is that type assertion can be sometime (not always) be resolved at compile time, or else during execution, only when concrete type is known, and that we use the same checking function. We should really have 2 implementations here, one for compile time, the other for execution, but it is another level of effort.