mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
1d20bce981
commit
9d0772b23e
1 changed files with 17 additions and 0 deletions
17
src/cmd/compile/internal/syntax/testdata/issue70974.go
vendored
Normal file
17
src/cmd/compile/internal/syntax/testdata/issue70974.go
vendored
Normal file
|
|
@ -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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue