]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.typeparams] go/types: use a new ast.ListExpr for multi-type instances
authorRob Findley <rfindley@google.com>
Wed, 17 Feb 2021 00:56:38 +0000 (19:56 -0500)
committerRobert Findley <rfindley@google.com>
Thu, 18 Feb 2021 20:38:41 +0000 (20:38 +0000)
commit5ecb9a788716be799d73c5d8192368ecb9557d48
treec7909d74c3a563816463aa0728fd0904a905b2bc
parent7b679617f3bb532fe65d8e83365b9f1f41b01b00
[dev.typeparams] go/types: use a new ast.ListExpr for multi-type instances

Modify go/parser to consistently represent type instantiation as an
ast.IndexExpr, rather than use an ast.CallExpr (with Brackets:true) for
instantiations with multiple type parameters. To enable this, introduce
a new ast expr type: ListExpr.

This brings go/types in line with types2, with the exception of a small
change to funcInst to eliminate redundant errors if values are
erroneously used as types. In a subsequent CL, call.go and expr.go will
be marked as reviewed.

This also catches some type instance syntax using '()' that was
previously accepted incorrectly. Tests are updated accordingly.

Change-Id: I30cd0181c7608f1be7486a9a8b63df993b412e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/293010
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
14 files changed:
src/go/ast/ast.go
src/go/ast/example_test.go
src/go/parser/parser.go
src/go/printer/nodes.go
src/go/types/api_test.go
src/go/types/assignments.go
src/go/types/call.go
src/go/types/examples/functions.go2
src/go/types/expr.go
src/go/types/exprstring.go
src/go/types/resolver.go
src/go/types/testdata/issues.go2
src/go/types/testdata/typeparams.go2
src/go/types/typexpr.go