Skip to content

Commit

Permalink
go/ast/astutil: fix panic when rewriting multi-argument type instances
Browse files Browse the repository at this point in the history
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 <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
  • Loading branch information
findleyr committed Jun 9, 2021
1 parent a91e1fe commit 11dc2c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion typeparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 11dc2c4

Please sign in to comment.