diff options
| author | Robert Griesemer <gri@golang.org> | 2025-01-06 16:22:10 -0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-01-07 09:56:13 -0800 |
| commit | 9d0772b23ed8dae1667a3328a72f384eccf812d7 (patch) | |
| tree | abc5b589c822faa79da896923940cfc8811dbd97 /src/cmd/compile/internal/syntax | |
| parent | 1d20bce981005777424b9c8da199015ab2148810 (diff) | |
| download | go-9d0772b23ed8dae1667a3328a72f384eccf812d7.tar.xz | |
cmd/compile/internal/syntax: add test case for invalid label use
This case is not properly handled by the type checkers (see issue)
but the compiler uses the parser's label checking so it works as
expected.
For #70974.
Change-Id: I0849376bf7514a9a7730846649c3fe28c91f44ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/640895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/cmd/compile/internal/syntax')
| -rw-r--r-- | src/cmd/compile/internal/syntax/testdata/issue70974.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/testdata/issue70974.go b/src/cmd/compile/internal/syntax/testdata/issue70974.go new file mode 100644 index 0000000000..ebc69eda95 --- /dev/null +++ b/src/cmd/compile/internal/syntax/testdata/issue70974.go @@ -0,0 +1,17 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package p + +func _() { +M: +L: + for range 0 { + break L + break /* ERROR invalid break label M */ M + } + for range 0 { + break /* ERROR invalid break label L */ L + } +} |
