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: tip regression: "incompatible type" error message should include more info #48483

rogpeppe opened this issue Sep 20, 2021 · 2 comments


Copy link

@rogpeppe rogpeppe commented Sep 20, 2021

commit a83a558

When a type isn't compatible with an interface type because it doesn't implement the required methods, the compiler used to mention at least one method that's messing. With the latest tip that's no longer the case - it just says "incompatible type" with no hint as to what's wrong.

For example, with this code:

package main

type I interface {

type S struct{}

func (S) Foo() {

func main() {
	var _ I = S{}

Go 1.17 prints the error:

./tst.go:14:6: cannot use S{} (type S) as type I in assignment:
	S does not implement I (missing Bar method)

but Go tip just prints:

./tst.go:14:12: incompatible type: cannot use S{} (value of type S) as I value

Historically I've found the additional information extremely helpful, so I think it should be reinstated.
Aside: I'd actually go further than that - I've often thought that it would be better if the error
showed all the missing methods, not just some arbitrary method, because that gives a better
idea of what's going on.

Copy link

@cuonglm cuonglm commented Sep 20, 2021

Seems duplicated of #48471


Copy link
Contributor Author

@rogpeppe rogpeppe commented Sep 20, 2021

@cuonglm Thanks! I agree that this is a dupe.


@rogpeppe rogpeppe closed this Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants