aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorRobert Findley <rfindley@google.com>2021-08-16 16:40:57 -0400
committerRobert Findley <rfindley@google.com>2021-08-23 12:26:30 +0000
commitc7e354d9d1975a3e55c8eb9e79c22106c4b770c4 (patch)
treeb11fd691f2c270f3cbb40daa8432c9a0140c71eb /src/cmd
parentc1a14781eca85e9c705c782aa2071a5f9c23c09e (diff)
downloadgo-c7e354d9d1975a3e55c8eb9e79c22106c4b770c4.tar.gz
go-c7e354d9d1975a3e55c8eb9e79c22106c4b770c4.zip
go/types: return an error from Instantiate
This is a port of CL 342152 to go/types. Additionally, a panic was removed from interface substitution, which is a fix from CL 333155 that was previously missed. A check for a nil Checker was also removed from types2.instantiate, since check must not be nil in that method. Change-Id: I4ea6bdccbd50ea2008ee6d870f702bee5cdd5a8e Reviewed-on: https://go-review.googlesource.com/c/go/+/342671 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>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/types2/instantiate.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types2/instantiate.go b/src/cmd/compile/internal/types2/instantiate.go
index e0d889aa85..fdb8c40572 100644
--- a/src/cmd/compile/internal/types2/instantiate.go
+++ b/src/cmd/compile/internal/types2/instantiate.go
@@ -53,7 +53,8 @@ func Instantiate(check *Checker, typ Type, targs []Type, validate bool) (Type, e
// later in the type checking pass. For Named types the resulting instance will
// be unexpanded.
func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, posList []syntax.Pos) (res Type) {
- if check != nil && check.conf.Trace {
+ assert(check != nil)
+ if check.conf.Trace {
check.trace(pos, "-- instantiating %s with %s", typ, typeListString(targs))
check.indent++
defer func() {
@@ -69,7 +70,6 @@ func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, posLis
}()
}
- assert(check != nil)
inst := check.instance(pos, typ, targs)
assert(len(posList) <= len(targs))