aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/testdata
AgeCommit message (Collapse)Author
2021-08-15cmd/compile/internal/types2: better error message for index syntax error ↵Robert Griesemer
(follow-up) For #47704. Change-Id: I09e6f638df0cd456a20a3b68ab55c47bb5b1f555 Reviewed-on: https://go-review.googlesource.com/c/go/+/342370 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>
2021-08-15cmd/compile/internal/syntax: better error message for index syntax errorRobert Griesemer
Fixes #47704. Change-Id: I1de9fd00baaa4b534c23f011ade54120f5153a9d Reviewed-on: https://go-review.googlesource.com/c/go/+/342369 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-18[dev.typeparams] cmd/compile/internal/syntax: convert (most) parser tests to ↵Robert Griesemer
new type set syntax Left a couple of tests with old notation so that we keep testing it while the notation is still supported. Change-Id: Ia6a3e7911af87eaccc7b06189c10f79789575a98 Reviewed-on: https://go-review.googlesource.com/c/go/+/328256 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-05[dev.typeparams] cmd/compile/internal/syntax: not all index expressions can ↵Robert Griesemer
be instantiated types An index expression followed by an opening "{" may indicate a composite literal but only if the index expression can be a type. Exclude cases where the index expression cannot be a type (e.g. s[0], a[i+j], etc.). This leads to a better error message in code that is erroneous. Fixes #46558. Change-Id: Ida9291ca30683c211812dfb95abe4969f44c474f Reviewed-on: https://go-review.googlesource.com/c/go/+/325009 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-05-19[dev.typeparams] cmd/compile/internal/syntax: accept embedded type literalsRobert Griesemer
The parser accepted embedded elements but the first term of an element had to be a ~-term or a type name. This CL fixes that. Change-Id: I013b6cdc5963fb228867ca6597f9139db2be7ec5 Reviewed-on: https://go-review.googlesource.com/c/go/+/321109 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-15cmd/compile/internal/syntax: fix error message for ... without typeRobert Griesemer
Only complain about missing type; leave it to type-checking to decide whether "..." is permitted in the first place. Fixes #43674. Change-Id: Icbc8f084e364fe3ac16076406a134354219c08d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/310209 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-10cmd/compile/internal/syntax: accept "~" and "|" interface elementsRobert Griesemer
Type lists continue to be accepted as before. While at it, print missing filenames in error tests (which uses an ad-hoc position representation). Change-Id: I933b3acbc9cf1985ad8f70f6b206e3a1dbd64d1e Reviewed-on: https://go-review.googlesource.com/c/go/+/307371 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-12-16[dev.typeparams] cmd/compile/internal/syntax: type parameters must always be ↵Robert Griesemer
named Report an error otherwise. Change-Id: Ia76ea03a3f26b13dd9bca49f7bd42101d1ff1f9e Reviewed-on: https://go-review.googlesource.com/c/go/+/278475 Trust: Robert Griesemer <gri@golang.org> Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-10-13[dev.typeparams] cmd/compile/internal/syntax: add type parameter testsRobert Griesemer
The file endings are not .go so that gofmt leaves these files alone. They are also not .src to distinguish them from regular go source tests. Change-Id: I741f5c037bad1ea9d6f7fda3673487d0be631350 Reviewed-on: https://go-review.googlesource.com/c/go/+/261219 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>
2020-02-21cmd/compile/internal/syntax: better error when an assignment is used in ↵Robert Griesemer
value context The error message is now positioned at the statement position (which is an identifing token, such as the '=' for assignments); and in case of assignments it emphasizes the assignment by putting the Lhs and Rhs in parentheses. Finally, the wording is changed from "use of * as value" to the stronger "cannot use * as value" (for which there is precedent elsewhere in the parser). Fixes #36858. Change-Id: Ic3f101bba50f58e3a1d9b29645066634631f2d61 Reviewed-on: https://go-review.googlesource.com/c/go/+/218337 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-04-03cmd/compile: better recovery after := (rather than =) in declarationsRobert Griesemer
Before this fix, a mistaken := in a (const/type/var) declaration ended that declaration with an error from which the parser didn't recover well. This low-cost change will provide a better error message and lets the parser recover perfectly. Fixes #31092. Change-Id: Ic4f94dc5e29dd00b7ef6d53a80dded638e3cea80 Reviewed-on: https://go-review.googlesource.com/c/go/+/169958 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-02-12cmd/compile/internal/syntax: added test cases for recent fixesRobert Griesemer
R=go1.11. Now that we have a syntax error test harness, we can add the proper tests for the recent parser fixes. For #20800. For #20789. For #23385. For #23434. A test for #20789 already exists in test/fixedbugs, but this is the better location for that test. But leaving the existing one where it is as well. Change-Id: I5937b9b63bafd1efab467a00344302e717976171 Reviewed-on: https://go-review.googlesource.com/88336 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-02-12cmd/compile/internal/syntax: implement regression test harness for syntax errorsRobert Griesemer
R=go1.11 Fixes #20800. Change-Id: Ifea273521d42a543a43da2f655ace7c295650e30 Reviewed-on: https://go-review.googlesource.com/88335 Reviewed-by: Matthew Dempsky <mdempsky@google.com>