Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: regressed and non-informative error messages missing unimplemented methods when interface isn't satisfied #48833

Closed
odeke-em opened this issue Oct 7, 2021 · 2 comments
Milestone

Comments

@odeke-em
Copy link
Member

odeke-em commented Oct 7, 2021

What version of Go are you using (go version)?

GoTip at 6f74ed0 aka Go1.18

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Not Applicable

What did you do?

Ran this program https://play.golang.org/p/Uan-Gj9JgbI or inlined below

package main

type Reader interface {
	Read() (int, error)
}

type rr int

var _ Reader = (*rr)(nil)

func main() {}

What did you expect to see?

./main.go:9:5: cannot use (*rr)(nil) (type *rr) as type Reader in assignment:
	*rr does not implement Reader (missing Read method)

What did you see instead?

./main.go:9:16: incompatible type: cannot use (*rr)(nil) (value of type *rr) as Reader value

Others and myself laboured in prior Go cycles to have informative error messages when interfaces weren't satisifed, and we wrote tests to lock this behavior in. We also got feedback from the community about the helpfulness of the prior user experience. I am surprised that this regressed quietly or that the tests perhaps got deleted.

Kindly cc-ing @griesemer @mdempsky

@odeke-em odeke-em added this to the Go1.18 milestone Oct 7, 2021
@ericlagergren
Copy link
Contributor

Dupe of #48471?

@odeke-em
Copy link
Member Author

odeke-em commented Oct 7, 2021

Thank you @ericlagergren for pointing me to that issue! I implemented the prior diagnostics so looks like it is time for me to roll my sleeves up again soon :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants