| 1 |
This test checks completion of labels. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-ignore_extra_diags |
| 5 |
|
| 6 |
-- labels.go -- |
| 7 |
package labels |
| 8 |
|
| 9 |
func _() { |
| 10 |
goto F //@complete(re"() \\/\\/", label1, label5) |
| 11 |
|
| 12 |
Foo1: //@item(label1, "Foo1", "label", "const") |
| 13 |
for a, b := range []int{} { |
| 14 |
Foo2: //@item(label2, "Foo2", "label", "const") |
| 15 |
switch { |
| 16 |
case true: |
| 17 |
break F //@complete(re"() \\/\\/", label2, label1) |
| 18 |
|
| 19 |
continue F //@complete(re"() \\/\\/", label1) |
| 20 |
|
| 21 |
{ |
| 22 |
FooUnjumpable: |
| 23 |
} |
| 24 |
|
| 25 |
goto F //@complete(re"() \\/\\/", label1, label2, label4, label5) |
| 26 |
|
| 27 |
func() { |
| 28 |
goto F //@complete(re"() \\/\\/", label3) |
| 29 |
|
| 30 |
break F //@complete(re"() \\/\\/") |
| 31 |
|
| 32 |
continue F //@complete(re"() \\/\\/") |
| 33 |
|
| 34 |
Foo3: //@item(label3, "Foo3", "label", "const") |
| 35 |
}() |
| 36 |
} |
| 37 |
|
| 38 |
Foo4: //@item(label4, "Foo4", "label", "const") |
| 39 |
switch any(a).(type) { |
| 40 |
case int: |
| 41 |
break F //@complete(re"() \\/\\/", label4, label1) |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
break F //@complete(re"() \\/\\/") |
| 46 |
|
| 47 |
continue F //@complete(re"() \\/\\/") |
| 48 |
|
| 49 |
Foo5: //@item(label5, "Foo5", "label", "const") |
| 50 |
for { |
| 51 |
break F //@complete(re"() \\/\\/", label5) |
| 52 |
} |
| 53 |
|
| 54 |
return |
| 55 |
} |