diff options
author | Rob Findley <rfindley@google.com> | 2021-04-19 19:10:09 -0400 |
---|---|---|
committer | Robert Findley <rfindley@google.com> | 2021-04-20 00:14:27 +0000 |
commit | 9f87943424df86e501175e10e5e3b8b00dfd03d7 (patch) | |
tree | bbe151ed0b53f63fead0a1878fe280f1664ad394 /src/go/types/expr.go | |
parent | 3711ea0b5d1bc381bda02ec3fe16369ed997eda6 (diff) | |
download | go-9f87943424df86e501175e10e5e3b8b00dfd03d7.tar.gz go-9f87943424df86e501175e10e5e3b8b00dfd03d7.zip |
go/types: fix panic when using multiple type arguments
Fix a panic caused by using type arguments without first unpacking.
This was noticed in the review of CL 300998, but unfortunately not yet
fixed.
Fixes #45635
Change-Id: I8ab1720f3e27a6002bc925f0eea943ec6f778341
Reviewed-on: https://go-review.googlesource.com/c/go/+/311669
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/go/types/expr.go')
-rw-r--r-- | src/go/types/expr.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/go/types/expr.go b/src/go/types/expr.go index 170761afb3..5576c43819 100644 --- a/src/go/types/expr.go +++ b/src/go/types/expr.go @@ -10,6 +10,7 @@ import ( "fmt" "go/ast" "go/constant" + "go/internal/typeparams" "go/token" "math" ) @@ -1435,7 +1436,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind { case *ast.IndexExpr: check.exprOrType(x, e.X) if x.mode == invalid { - check.use(e.Index) + check.use(typeparams.UnpackExpr(e.Index)...) goto Error } |