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
169 B
Go
11 lines
169 B
Go
package main
|
|
|
|
func f(x string) (a int, b int) { return x, 5 }
|
|
|
|
func main() {
|
|
print("hello")
|
|
}
|
|
|
|
// Error:
|
|
// cannot use x (type stringT) as type intT in return argument
|