]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: fix bug in types2.MissingMethod
authorRobert Griesemer <gri@golang.org>
Thu, 3 Feb 2022 00:31:26 +0000 (16:31 -0800)
committerRobert Griesemer <gri@golang.org>
Fri, 4 Feb 2022 23:42:43 +0000 (23:42 +0000)
commitd9eba71a643f31e509dd08884509c5b2c1ab26a4
treec8ec17a8e4c3260dd94003a4f7130d6bdac5c972
parent727790a2fda02e75844ce91320c05fd2bf1f431d
go/types, types2: fix bug in types2.MissingMethod

Because Checker.missingMethod also looks up methods matching
matching case-folded names, when Checker.missingMethod returns
an alternative method, that method does not automatically have
the wrong type. It may be a method with a different name.

Adjust types2.MissingMethod to check the alternative method
name before reporting a wrong type.

Add API test that verifies (now correct) behavior for this
case.

Ported the code also to go/types, though it was not a bug
there yet because looking up with case-folding is not yet
enabled.

Change-Id: Iaa48808535c9265a9879338ea666c6c021e93a2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/382634
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/api_test.go
src/cmd/compile/internal/types2/lookup.go
src/go/types/api_test.go
src/go/types/lookup.go