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
The Parent of an Object representing an interface method or struct field is nil, which is a surprise: you might expect its parent to be the enclosing file or local scope that defines the environment in which the object's declaration is resolved. It is also undocumented.
Given that nothing was specified, I would not be averse to changing the behavior, though it would certainly cause some existing programs to break and may violate the spirit of the compatibility rules.
In any case we should clearly document the behavior.
The text was updated successfully, but these errors were encountered:
Struct fields, type-associated and interface methods are not declared in a block scope, which is what parent scopes refer to. They are conceivably declared in a type-specific "scope" but that's just not how types.Scopes are used. Hence those objects' parent scopes are nil.
I don't think it makes sense to change this now. I'll document it.
The Parent of an Object representing an interface method or struct field is nil, which is a surprise: you might expect its parent to be the enclosing file or local scope that defines the environment in which the object's declaration is resolved. It is also undocumented.
Given that nothing was specified, I would not be averse to changing the behavior, though it would certainly cause some existing programs to break and may violate the spirit of the compatibility rules.
In any case we should clearly document the behavior.
The text was updated successfully, but these errors were encountered: