diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 19:22:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 19:22:03 +0000 |
commit | 52b4757d798fb3fa2072230515c3ca1e22635941 (patch) | |
tree | 359ed7901c3ea0075b5cbee1aad4f48eb8ee3a31 /src/go | |
parent | Adding upstream version 1.21.8. (diff) | |
download | golang-1.21-52b4757d798fb3fa2072230515c3ca1e22635941.tar.xz golang-1.21-52b4757d798fb3fa2072230515c3ca1e22635941.zip |
Adding upstream version 1.21.9.upstream/1.21.9
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/go')
-rw-r--r-- | src/go/types/typeset.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/go/types/typeset.go b/src/go/types/typeset.go index 4cd118a..a7d4485 100644 --- a/src/go/types/typeset.go +++ b/src/go/types/typeset.go @@ -253,9 +253,8 @@ func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_T allTerms := allTermlist allComparable := false for i, typ := range ityp.embeddeds { - // The embedding position is nil for imported interfaces - // and also for interface copies after substitution (but - // in that case we don't need to report errors again). + // The embedding position is nil for imported interfaces. + // We don't need to do version checks in those cases. var pos token.Pos // embedding position if ityp.embedPos != nil { pos = (*ityp.embedPos)[i] @@ -268,7 +267,7 @@ func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_T assert(!isTypeParam(typ)) tset := computeInterfaceTypeSet(check, pos, u) // If typ is local, an error was already reported where typ is specified/defined. - if check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(atPos(pos), go1_18, "embedding constraint interface %s", typ) { + if pos.IsValid() && check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(atPos(pos), go1_18, "embedding constraint interface %s", typ) { continue } comparable = tset.comparable @@ -277,7 +276,7 @@ func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_T } terms = tset.terms case *Union: - if check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding interface element %s", u) { + if pos.IsValid() && check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding interface element %s", u) { continue } tset := computeUnionTypeSet(check, unionSets, pos, u) @@ -291,7 +290,7 @@ func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_T if u == Typ[Invalid] { continue } - if check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding non-interface type %s", typ) { + if pos.IsValid() && check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding non-interface type %s", typ) { continue } terms = termlist{{false, typ}} |