blob: 8efccfcdb668b91c76dcbbee10a986dd96605bb9 [file]
This is a regression test for issue 65752: a break in a switch should
highlight the switch, not the enclosing loop.
We suppress staticheck since it also gives a diagnostic
about the break being ineffective.
-- settings.json --
{
"staticcheck": false
}
-- a.go --
package a
func _(x any) {
for {
// type switch
switch x.(type) { //@hiloc(tswitch, "switch", text)
default:
break //@hiloc(tbreak, "break", text),highlight(tbreak, tswitch, tbreak)
}
// value switch
switch { //@hiloc(vswitch, "switch", text)
default:
break //@hiloc(vbreak, "break", text), highlight(vbreak, vswitch, vbreak)
}
}
}