This CL reverses the change in CL 284254 (which was ported
to types2) which originated in CL 240901 to address a crash
in a test created by a fuzzer (that crash appears to be
avoided in other ways, now).
This exposed another bug in typeset.go where we don't look
for the underlying type when testing if a type is an interface
or not. Fixed that as well.
Adjusted a test case that now doesn't report an error anymore
(which is good).
Fixes #48819.
Change-Id: I611d68e053d6b8a2f7176d0cd5a44da2df28ad21
Reviewed-on: https://go-review.googlesource.com/c/go/+/354329
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
if tn == t.obj {
check.cycleError(path[i:])
t.info = invalid
+ t.underlying = Typ[Invalid]
return t.info
}
}
type Zero struct{}
type Succ struct{
- Nat // ERROR interface contains type constraints
+ Nat // Nat contains type constraints but is invalid, so no error
}
// Struct tests.
--- /dev/null
+// Copyright 2021 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 p
+
+import "unsafe"
+
+type T /* ERROR illegal cycle in declaration of T */ struct {
+ T
+}
+
+func _(t T) {
+ _ = unsafe.Sizeof(t) // should not go into infinite recursion here
+}
// Union parsing reports a (delayed) error, so we can ignore this entry.
continue
default:
- if typ == Typ[Invalid] {
+ if u == Typ[Invalid] {
continue
}
if check != nil && !check.allowVersion(check.pkg, 1, 18) {