aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/expr.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2020-12-09 19:15:15 -0800
committerRobert Griesemer <gri@golang.org>2020-12-14 21:27:49 +0000
commitdf58f3368e62fbc290b419f0b33b97a984b9ca19 (patch)
tree44b9d903ab143737900f2c51359a1372911ad536 /src/cmd/compile/internal/types2/expr.go
parent91803a2df334ddfc9377ef4d07cc5f0eff51b6a2 (diff)
downloadgo-df58f3368e62fbc290b419f0b33b97a984b9ca19.tar.gz
go-df58f3368e62fbc290b419f0b33b97a984b9ca19.zip
[dev.typeparams] cmd/compile/internal/types2: don't report two errors for bad strings
If the parser reported an error for (string) literals, don't report a second error during type checking. This should have a couple of tests but they are tricky to arrange with the current testing framework as the ERROR comment cannot be on the line where the string. But the change is straightforward and we have test/fixedbugs/issue32133.go that is passing now. Change-Id: I0cd7f002b04e4092b8eb66009c7413288c8bfb23 Reviewed-on: https://go-review.googlesource.com/c/go/+/277993 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/types2/expr.go')
-rw-r--r--src/cmd/compile/internal/types2/expr.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types2/expr.go b/src/cmd/compile/internal/types2/expr.go
index 252d4814cc..34cbefc864 100644
--- a/src/cmd/compile/internal/types2/expr.go
+++ b/src/cmd/compile/internal/types2/expr.go
@@ -1188,7 +1188,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
case *syntax.BasicLit:
if e.Bad {
- goto Error // error was reported before
+ goto Error // error reported during parsing
}
x.setConst(e.Kind, e.Value)
if x.mode == invalid {