mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
The assignable check used to be too strict as it lacked the property that if an untyped const can be represented as a T, then it is assignable to T. And we can now use that fixed check to add a missing check: in a return statement, we now make sure that any of the returned elements are assignable to what the signature tells us they should be.
11 lines
170 B
Go
11 lines
170 B
Go
package main
|
|
|
|
func f(x int) (int, int) { return x, "foo" }
|
|
|
|
func main() {
|
|
print("hello")
|
|
}
|
|
|
|
// Error:
|
|
// cannot use "foo" (type stringT) as type intT in return argument
|