mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
go/types, types2: remove superfluous assertion (fix build)
Remove an assertion that was overly restrictive and hard to get correct under all circumstances (i.e., in the presence of incorrect) code. This matches the code for *Named types in that specific switch. Fixes #71284. Change-Id: Ifccf8b73dc70cac9cb1c8b24946d16851d511454 Reviewed-on: https://go-review.googlesource.com/c/go/+/643255 Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
1a93e4a2cf
commit
80bf7d83ed
3 changed files with 10 additions and 10 deletions
|
|
@ -423,11 +423,6 @@ func setDefType(def *TypeName, typ Type) {
|
|||
if def != nil {
|
||||
switch t := def.typ.(type) {
|
||||
case *Alias:
|
||||
// t.fromRHS should always be set, either to an invalid type
|
||||
// in the beginning, or to typ in certain cyclic declarations.
|
||||
if t.fromRHS != Typ[Invalid] && t.fromRHS != typ {
|
||||
panic(sprintf(nil, true, "t.fromRHS = %s, typ = %s\n", t.fromRHS, typ))
|
||||
}
|
||||
t.fromRHS = typ
|
||||
case *Basic:
|
||||
assert(t == Typ[Invalid])
|
||||
|
|
|
|||
|
|
@ -419,11 +419,6 @@ func setDefType(def *TypeName, typ Type) {
|
|||
if def != nil {
|
||||
switch t := def.typ.(type) {
|
||||
case *Alias:
|
||||
// t.fromRHS should always be set, either to an invalid type
|
||||
// in the beginning, or to typ in certain cyclic declarations.
|
||||
if t.fromRHS != Typ[Invalid] && t.fromRHS != typ {
|
||||
panic(sprintf(nil, nil, true, "t.fromRHS = %s, typ = %s\n", t.fromRHS, typ))
|
||||
}
|
||||
t.fromRHS = typ
|
||||
case *Basic:
|
||||
assert(t == Typ[Invalid])
|
||||
|
|
|
|||
10
src/internal/types/testdata/fixedbugs/issue71284.go
vendored
Normal file
10
src/internal/types/testdata/fixedbugs/issue71284.go
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright 2025 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.
|
||||
|
||||
package A
|
||||
|
||||
type (
|
||||
_ = A
|
||||
A /* ERROR "invalid recursive type: A refers to itself" */ = A
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue