go/types, types2: add an assertion that named type origin is idempotent

For #46794

Change-Id: I19edc19640a2dfa6bc7504dd8e1742a261ba29f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/393368
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Robert Findley 2022-03-16 16:52:30 -04:00
parent adae6ec542
commit 4a46e6e44c
2 changed files with 2 additions and 0 deletions

View File

@ -78,6 +78,7 @@ func (check *Checker) newNamed(obj *TypeName, orig *Named, underlying Type, tpar
}
func (t *Named) cleanup() {
assert(t.orig.orig == t.orig)
// Ensure that every defined type created in the course of type-checking has
// either non-*Named underlying, or is unresolved.
//

View File

@ -78,6 +78,7 @@ func (check *Checker) newNamed(obj *TypeName, orig *Named, underlying Type, tpar
}
func (t *Named) cleanup() {
assert(t.orig.orig == t.orig)
// Ensure that every defined type created in the course of type-checking has
// either non-*Named underlying, or is unresolved.
//