| 1 |
This is a regression test for issue 65752: a break in a switch should |
| 2 |
highlight the switch, not the enclosing loop. |
| 3 |
|
| 4 |
We suppress staticheck since it also gives a diagnostic |
| 5 |
about the break being ineffective. |
| 6 |
|
| 7 |
-- settings.json -- |
| 8 |
{ |
| 9 |
"staticcheck": false |
| 10 |
} |
| 11 |
|
| 12 |
-- a.go -- |
| 13 |
package a |
| 14 |
|
| 15 |
func _(x any) { |
| 16 |
for { |
| 17 |
// type switch |
| 18 |
switch x.(type) { //@hiloc(tswitch, "switch", text) |
| 19 |
default: |
| 20 |
break //@hiloc(tbreak, "break", text),highlight(tbreak, tswitch, tbreak) |
| 21 |
} |
| 22 |
|
| 23 |
// value switch |
| 24 |
switch { //@hiloc(vswitch, "switch", text) |
| 25 |
default: |
| 26 |
break //@hiloc(vbreak, "break", text), highlight(vbreak, vswitch, vbreak) |
| 27 |
} |
| 28 |
} |
| 29 |
} |