From 11dc2c41198b9cc326ea8b9f0ea0d2f337539ff9 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Tue, 8 Jun 2021 17:10:41 -0400 Subject: [PATCH] go/ast/astutil: fix panic when rewriting multi-argument type instances Use the typeparams helper package to fix AST rewriting in go/ast/astutil when encountering the new ListExpr type. This is liable to break in the future when the go/ast API changes, but at least it will be easy to find by virtue of using internal/typeparams. Fixes golang/vscode-go#1551 Change-Id: Id34bbcdede9024ed9818bef6d73a19e993dd76a8 Reviewed-on: https://go-review.googlesource.com/c/tools/+/326131 Trust: Robert Findley Run-TryBot: Robert Findley Reviewed-by: Matthew Dempsky gopls-CI: kokoro TryBot-Result: Go Bot --- typeparams.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typeparams.go b/typeparams.go index 624ce37..6b7958a 100644 --- a/typeparams.go +++ b/typeparams.go @@ -101,5 +101,5 @@ func GetInferred(info *types.Info, e ast.Expr) ([]types.Type, *types.Signature) return nil, nil } inf := info.Inferred[e] - return inf.Targs, inf.Sig + return inf.TArgs, inf.Sig }