What version of Go are you using (go version)?
$ go version
go version devel go1.18-6eb58cdffa Tue Jan 25 22:56:45 2022 +0000 linux/amd64
Does this issue reproduce with the latest release?
No.
What did you do?
https://go.dev/play/p/M_0U_6fSpFp
What did you expect to see?
./foo.go:17:7: impossible type assertion:
T1 does not implement I (missing Foo method)
have foo()
want Foo()
./foo.go:18:7: impossible type assertion:
T2 does not implement I (missing Foo method)
have foo() string
want Foo()
What did you see instead?
./foo.go:17:7: impossible type assertion: i.(T1)
T1 does not implement I (missing Foo method)
have foo() at ./foo.go:9:11
want Foo()
./foo.go:18:7: impossible type assertion: i.(T2)
T2 does not implement I (wrong type for Foo method)
have foo() string at ./foo.go:13:11
want Foo()
The compiler complains about the wrong signature even though the method names don't match, which I think is the more important error to report. Bisects to 429d1e0.
/cc @danscales
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
No.
What did you do?
https://go.dev/play/p/M_0U_6fSpFp
What did you expect to see?
What did you see instead?
The compiler complains about the wrong signature even though the method names don't match, which I think is the more important error to report. Bisects to 429d1e0.
/cc @danscales