You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see this error message with the key point being the type signature just looks wrong:
tmp/sandbox076937847/main.go:15: cannot use new(Impl) (type *Impl) as type I in assignment:
*Impl does not implement I (wrong type for F method)
have F(*B, *B)
want F(A, *B)
It says have F(*B, *B) but if you look at the source thats not what you see and its very confusing.
The text was updated successfully, but these errors were encountered:
odeke-em
changed the title
Incorrect compiler error message when mixing named/unamed with an interface arg type
cmd/compile: incorrect error message when mixing named/unamed with an interface arg type
Oct 8, 2016
I can see that now (I'm just so used to lowercase var names). That is really confusing but I can see how that's possible. I can see how this probably isn't a bug then and I'll close it.
What version of Go are you using (
go version
)?go version go1.7.1 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
https://play.golang.org/p/4UIQBFK6tm
What did you expect to see?
I expect this error message:
Which you get if you change the
A
parameter to a pointer to A (noticeA
just changed to*A
):https://play.golang.org/p/EoGX8zfkKj
What did you see instead?
I see this error message with the key point being the type signature just looks wrong:
It says
have F(*B, *B)
but if you look at the source thats not what you see and its very confusing.The text was updated successfully, but these errors were encountered: