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
Currently, we create a stack of scopes for naming anonymous fields. This is wrong because it doesn't 'Find refs' to work across different instances of the same anonymous struct, which may be semantically linked to one another.
type Y struct {
x struct { t int }
z struct { t int }
}
func xz(y Y) {
y.x = y.z // OK
}
The two anonymous struct types are the same type, but using the field name in the type name will make them different.
The correct algorithm should be something like:
If the type is located inside a function body, it's name and the field names should be locals.
Otherwise
Sort all fields of the anonymous struct by name.
Construct a unique string based on all the fields, their canonical types, and the struct tags. E.g. you could just feed these into a hasher. Use this string as the descriptor suffix.
Depending on the outer context (e.g. if it's a private field, a private type, a function argument to a private function), the prefix should not include the package name and version to disable cross-repo navigation.
The text was updated successfully, but these errors were encountered:
Currently, we create a stack of scopes for naming anonymous fields. This is wrong because it doesn't 'Find refs' to work across different instances of the same anonymous struct, which may be semantically linked to one another.
The two anonymous struct types are the same type, but using the field name in the type name will make them different.
The correct algorithm should be something like:
The text was updated successfully, but these errors were encountered: