aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/errors.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2020-10-22 15:32:05 -0700
committerRobert Griesemer <gri@golang.org>2020-10-27 03:37:05 +0000
commit87eab74628bc23831bd783806e8ec16927bd9a50 (patch)
treeadac6d1cd51a2d77dbc10926b5be0894c2a4dfd2 /src/cmd/compile/internal/types2/errors.go
parent5bfd2964a6519c8046b16b41bb9f84ecb6202356 (diff)
downloadgo-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/errors.go')
-rw-r--r--src/cmd/compile/internal/types2/errors.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types2/errors.go b/src/cmd/compile/internal/types2/errors.go
index 5211439f89..07f9aad48b 100644
--- a/src/cmd/compile/internal/types2/errors.go
+++ b/src/cmd/compile/internal/types2/errors.go
@@ -8,6 +8,7 @@
package types2
import (
+ "bytes"
"cmd/compile/internal/syntax"
"fmt"
"strconv"
@@ -145,7 +146,8 @@ func posFor(at poser) syntax.Pos {
// stripAnnotations removes internal (type) annotations from s.
func stripAnnotations(s string) string {
- var b strings.Builder
+ // Would like to use strings.Builder but it's not available in Go 1.4.
+ var b bytes.Buffer
for _, r := range s {
// strip #'s and subscript digits
if r != instanceMarker && !('₀' <= r && r < '₀'+10) { // '₀' == U+2080