@@ -67,13 +67,13 @@ func lookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string, fo
67
67
68
68
obj , index , indirect = lookupFieldOrMethodImpl (T , addressable , pkg , name , foldCase )
69
69
70
- // If we didn't find anything and if we have a type parameter with a core type,
71
- // see if there is a matching field (but not a method, those need to be declared
72
- // explicitly in the constraint). If the constraint is a named pointer type (see
73
- // above), we are ok here because only fields are accepted as results.
70
+ // If we didn't find anything and if we have a type parameter with a shared underlying
71
+ // type, see if there is a matching field (but not a method, those need to be declared
72
+ // explicitly in the constraint). If the constraint is a named pointer type (see above),
73
+ // we are ok here because only fields are accepted as results.
74
74
const enableTParamFieldLookup = false // see go.dev/issue/51576
75
75
if enableTParamFieldLookup && obj == nil && isTypeParam (T ) {
76
- if t := coreType ( T ); t != nil {
76
+ if t := sharedUnder ( nil , T , nil ); t != nil {
77
77
obj , index , indirect = lookupFieldOrMethodImpl (t , addressable , pkg , name , foldCase )
78
78
if _ , ok := obj .(* Var ); ! ok {
79
79
obj , index , indirect = nil , nil , false // accept fields (variables) only
0 commit comments