diff options
author | Robert Griesemer <gri@golang.org> | 2020-10-22 15:32:05 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2020-10-27 03:37:05 +0000 |
commit | 87eab74628bc23831bd783806e8ec16927bd9a50 (patch) | |
tree | adac6d1cd51a2d77dbc10926b5be0894c2a4dfd2 /src/cmd/compile/internal/types2/infer.go | |
parent | 5bfd2964a6519c8046b16b41bb9f84ecb6202356 (diff) | |
download | go-87eab74628bc23831bd783806e8ec16927bd9a50.tar.gz go-87eab74628bc23831bd783806e8ec16927bd9a50.zip |
[dev.typeparams] cmd/compile: enable type-checking of generic code
This change makes a first connection between the compiler and types2.
When the -G flag is provided, the compiler accepts code using type
parameters; with this change generic code is also type-checked (but
then compilation ends).
Change-Id: I0fa6f6213267a458a6b33afe8ff26869fd838a63
Reviewed-on: https://go-review.googlesource.com/c/go/+/264303
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/infer.go')
-rw-r--r-- | src/cmd/compile/internal/types2/infer.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types2/infer.go b/src/cmd/compile/internal/types2/infer.go index b52a834e5a..125d3f31b9 100644 --- a/src/cmd/compile/internal/types2/infer.go +++ b/src/cmd/compile/internal/types2/infer.go @@ -8,7 +8,7 @@ package types2 -import "strings" +import "bytes" // infer returns the list of actual type arguments for the given list of type parameters tparams // by inferring them from the actual arguments args for the parameters params. If type inference @@ -134,7 +134,8 @@ func typeNamesString(list []*TypeName) string { } // general case (n > 2) - var b strings.Builder + // Would like to use strings.Builder but it's not available in Go 1.4. + var b bytes.Buffer for i, tname := range list[:n-1] { if i > 0 { b.WriteString(", ") |