]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/types2: clean up panics in instantiation
authorRobert Findley <rfindley@google.com>
Fri, 13 Aug 2021 16:03:29 +0000 (12:03 -0400)
committerRobert Findley <rfindley@google.com>
Wed, 18 Aug 2021 20:11:28 +0000 (20:11 +0000)
commit165ebd85a77db5f3454f38c6c3f1539f00cf2fef
tree2f4d342fa7a4d210f0872cb01ec37c1221f3522c
parent4a0fd73eaded9f395b3e5025ab9e1c5c5f124143
cmd/compile/internal/types2: clean up panics in instantiation

Clean up a few issues related to panicking during invalid instantiation.
 - Panic early in instantiateLazy when check == nil and verify == true.
   Otherwise, we would panic at check.later.
 - Always panic when check == nil and verify == true, even if targs is
   of incorrect length. This is more consistent behavior.
 - Lift the check for len(posList) <= len(targs) out of
   Checker.instantiate. This is the only reason why posList is passed to
   that function, and doing this allows us to eliminate posList from
   instance. At this point instance is close to being unnecessary, so
   update a TODO to this effect.

Change-Id: Id5f44cbb1a5897aef10ce2a573aa78acd7ae4026
Reviewed-on: https://go-review.googlesource.com/c/go/+/341862
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/types2/instantiate.go
src/cmd/compile/internal/types2/named.go