Skip to content

Commit 6adf08f

Browse files
griesemerRobert Griesemer
authored and
Robert Griesemer
committed
go/types, types2: remove coreType call in lookup
For #70128. Change-Id: I7d16ad7fdc6b07a2632b4eaefaedfa2bcceffe1d Reviewed-on: https://go-review.googlesource.com/c/go/+/652215 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Auto-Submit: Robert Griesemer <[email protected]>
1 parent f69703d commit 6adf08f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/cmd/compile/internal/types2/lookup.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ func lookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string, fo
6767

6868
obj, index, indirect = lookupFieldOrMethodImpl(T, addressable, pkg, name, foldCase)
6969

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.
7474
const enableTParamFieldLookup = false // see go.dev/issue/51576
7575
if enableTParamFieldLookup && obj == nil && isTypeParam(T) {
76-
if t := coreType(T); t != nil {
76+
if t := sharedUnder(nil, T, nil); t != nil {
7777
obj, index, indirect = lookupFieldOrMethodImpl(t, addressable, pkg, name, foldCase)
7878
if _, ok := obj.(*Var); !ok {
7979
obj, index, indirect = nil, nil, false // accept fields (variables) only

src/go/types/lookup.go

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)