]> Cypherpunks repositories - gostls13.git/commit
go/parser,go/types: hide API changes related to type parameters
authorRob Findley <rfindley@google.com>
Wed, 24 Feb 2021 15:31:11 +0000 (10:31 -0500)
committerRobert Findley <rfindley@google.com>
Tue, 2 Mar 2021 01:50:12 +0000 (01:50 +0000)
commita6eeb4add46eddb19ceba36bdd448738808e5ce2
tree06b2d25e5aef46c7ce3da6fae61e199025efdd88
parentff5cf4ced3f1681ec972cd954d4b476f87616fe3
go/parser,go/types: hide API changes related to type parameters

While the dev.typeparams branch was merged, the type parameter API is
slated for go1.18. Hide these changes to the go/parser and go/types API.

This was done as follows:
 + For APIs that will probably not be needed for go1.18, simply unexport
   them.
 + For APIs that we expect to export in go1.18, prefix symbols with '_',
   so that the planned (upper-cased) symbol name is apparent.
 + For APIs that must be exported for testing, move both API and tests
   to files guarded by the go1.18 build constraint.
 + parser.ParseTypeParams is unexported and copied wherever it is
   needed.
 + The -G flag is removed from gofmt, replaced by enabling type
   parameters if built with the go1.18 build constraint.

Notably, changes related to type parameters in go/ast are currently left
exported. We're looking at the AST API separately.

The new API diff from 1.16 is:
+pkg go/ast, method (*FuncDecl) IsMethod() bool
+pkg go/ast, method (*ListExpr) End() token.Pos
+pkg go/ast, method (*ListExpr) Pos() token.Pos
+pkg go/ast, type FuncType struct, TParams *FieldList
+pkg go/ast, type ListExpr struct
+pkg go/ast, type ListExpr struct, ElemList []Expr
+pkg go/ast, type TypeSpec struct, TParams *FieldList
+pkg go/types, type Config struct, GoVersion string\f

Change-Id: I1baf67e26279b49092e774309a836c460979774a
Reviewed-on: https://go-review.googlesource.com/c/go/+/295929
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>
31 files changed:
src/cmd/gofmt/gofmt.go
src/cmd/gofmt/gofmt_go1.18.go [new file with mode: 0644]
src/cmd/gofmt/gofmt_test.go
src/go/parser/error_test.go
src/go/parser/interface.go
src/go/parser/parser.go
src/go/parser/short_test.go
src/go/printer/printer_test.go
src/go/types/api.go
src/go/types/api_go1.18.go [new file with mode: 0644]
src/go/types/api_go1.18_test.go [new file with mode: 0644]
src/go/types/api_test.go
src/go/types/builtins.go
src/go/types/call.go
src/go/types/check.go
src/go/types/check_test.go
src/go/types/decl.go
src/go/types/expr.go
src/go/types/infer.go
src/go/types/lookup.go
src/go/types/operand.go
src/go/types/predicates.go
src/go/types/sanitize.go
src/go/types/scope.go
src/go/types/sizes.go
src/go/types/stmt.go
src/go/types/subst.go
src/go/types/type.go
src/go/types/typestring.go
src/go/types/typexpr.go
src/go/types/unify.go