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

go/types, types2: better error message for incompatible types due to method signature mismatch #45813

Closed
griesemer opened this issue Apr 28, 2021 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

See the example in issue #42841.

go/types and types2 produce an even less explicit error message. Match the compiler.

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 28, 2021
@griesemer griesemer added this to the Go1.18 milestone Apr 28, 2021
@griesemer griesemer self-assigned this Apr 28, 2021
@griesemer
Copy link
Contributor Author

cc: @findleyr

@odeke-em
Copy link
Member

odeke-em commented Jan 8, 2022

Howdy @griesemer and @findleyr! My CL https://go-review.googlesource.com/c/go/+/373634/ I believe fixes this issues to as it is now for go/types2, cmd/compile/types2 so let me update its commit message.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/373634 mentions this issue: cmd/compile/types2, go/types: add position for "have" in failed interface satisfaction

@odeke-em odeke-em self-assigned this Jan 8, 2022
jproberts pushed a commit to jproberts/go that referenced this issue Jun 21, 2022
…face satisfaction

With this change, we shall now see:

    *myS does not implement S (wrong type for DoSomething method)
        have DoSomething() (string, error) at ./main.go:9:14
	want DoSomething() (int, error)

instead of previously:

    *myS does not implement S (wrong type for DoSomething method)
        have DoSomething() (string, error)
	want DoSomething() (int, error)

Fixes golang#42841
Fixes golang#45813

Change-Id: I66990929e39b0d36f2e91da0d92f60586a9b84e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/373634
Trust: Robert Findley <rfindley@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants