[dev.typeparams] cmd/compile: fix bug with types2.Instantiate with interface type param

types2.subst has an assertion that check is non-nil, but which breaks
Instantiate() with an interface type param (used when re-importing
instatiated type to types2). But this check was added when Instantiate()
was added, and things seem to work fine when the assertion is removed.

Fixes test/typeparam/mdempsky/7.go.

Change-Id: I4980f0b202a0b310a3c91a7a87f97576f54911de
Reviewed-on: https://go-review.googlesource.com/c/go/+/333155
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
This commit is contained in:
Dan Scales 2021-07-07 12:03:41 -07:00
parent 85267f402c
commit 60cb2cab97
2 changed files with 0 additions and 4 deletions

View file

@ -313,9 +313,6 @@ func (subst *subster) typ(typ Type) Type {
embeddeds, ecopied := subst.typeList(t.embeddeds)
if mcopied || ecopied {
iface := &Interface{methods: methods, embeddeds: embeddeds, complete: t.complete}
if subst.check == nil {
panic("internal error: cannot instantiate interfaces yet")
}
return iface
}

View file

@ -2209,7 +2209,6 @@ var g3Failures = setOf(
"typeparam/mdempsky/3.go",
"typeparam/mdempsky/4.go",
"typeparam/mdempsky/5.go",
"typeparam/mdempsky/7.go",
"typeparam/mdempsky/9.go",
"typeparam/mdempsky/11.go",
"typeparam/mdempsky/12.go",