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
griesemer
changed the title
go/types: better error message for invalid method received
go/types: better error message for invalid method receiver
Oct 3, 2018
But when I look in the spec at the definition of aliases I see this:
Alias declarations
An alias declaration binds an identifier to the given type.
AliasDecl = identifier "=" Type .
Within the scope of the identifier, it serves as an alias for the type.
type ( nodeList = []*Node // nodeList and []*Node are identical types Polar = polar // Polar and polar denote identical types )
This suggests to me that T1 is identical to *T, and thus a valid method receiver.
I think with the current spec both examples should compile, although I admit using a type alias to hide a pointer is bad style. Otherwise the spec should be clarified on how aliases work together with method definitions.
@beoran@go101 Please discuss the validity of this at #27995. That's why I opened that one. This issue is just a reminder to follow up on go/types. Thanks.
For
go/types reports
which is misleading. The reason is that it drops the method m on the floor completely. Instead it should complain about the receiver.
See also issue #27995 .
The text was updated successfully, but these errors were encountered: