This reverts CL 571075.
Reason for revert: We might want to do a security-only minor release. Back off the release branch to a clean state from the previous minor release. Sorry for the inconvenience.
Change-Id: Ifc8c7e00e6faea3aa547b883eed44180ddb447de
Reviewed-on: https://go-review.googlesource.com/c/go/+/571355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
allTerms := allTermlist
allComparable := false
for i, typ := range ityp.embeddeds {
- // The embedding position is nil for imported interfaces.
- // We don't need to do version checks in those cases.
+ // 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).
var pos syntax.Pos // embedding position
if ityp.embedPos != nil {
pos = (*ityp.embedPos)[i]
assert(!isTypeParam(typ))
tset := computeInterfaceTypeSet(check, pos, u)
// If typ is local, an error was already reported where typ is specified/defined.
- if pos.IsKnown() && check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(pos, go1_18, "embedding constraint interface %s", typ) {
+ if check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(pos, go1_18, "embedding constraint interface %s", typ) {
continue
}
comparable = tset.comparable
}
terms = tset.terms
case *Union:
- if pos.IsKnown() && check != nil && !check.verifyVersionf(pos, go1_18, "embedding interface element %s", u) {
+ if check != nil && !check.verifyVersionf(pos, go1_18, "embedding interface element %s", u) {
continue
}
tset := computeUnionTypeSet(check, unionSets, pos, u)
if u == Typ[Invalid] {
continue
}
- if pos.IsKnown() && check != nil && !check.verifyVersionf(pos, go1_18, "embedding non-interface type %s", typ) {
+ if check != nil && !check.verifyVersionf(pos, go1_18, "embedding non-interface type %s", typ) {
continue
}
terms = termlist{{false, typ}}
allTerms := allTermlist
allComparable := false
for i, typ := range ityp.embeddeds {
- // The embedding position is nil for imported interfaces.
- // We don't need to do version checks in those cases.
+ // 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).
var pos token.Pos // embedding position
if ityp.embedPos != nil {
pos = (*ityp.embedPos)[i]
assert(!isTypeParam(typ))
tset := computeInterfaceTypeSet(check, pos, u)
// If typ is local, an error was already reported where typ is specified/defined.
- if pos.IsValid() && check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(atPos(pos), go1_18, "embedding constraint interface %s", typ) {
+ if check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(atPos(pos), go1_18, "embedding constraint interface %s", typ) {
continue
}
comparable = tset.comparable
}
terms = tset.terms
case *Union:
- if pos.IsValid() && check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding interface element %s", u) {
+ if check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding interface element %s", u) {
continue
}
tset := computeUnionTypeSet(check, unionSets, pos, u)
if u == Typ[Invalid] {
continue
}
- if pos.IsValid() && check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding non-interface type %s", typ) {
+ if check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding non-interface type %s", typ) {
continue
}
terms = termlist{{false, typ}}
+++ /dev/null
-// -lang=go1.16
-
-// Copyright 2024 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.21
-
-package main
-
-import "slices"
-
-func main() {
- _ = slices.Clone([]string{}) // no error should be reported here
-}