| 1 |
package pkg |
| 2 |
|
| 3 |
func fn() { |
| 4 |
var x, y int |
| 5 |
var z []int |
| 6 |
var a bool |
| 7 |
|
| 8 |
switch x { |
| 9 |
case 1, 2: //@ diag(`could use tagged switch on x`) |
| 10 |
case 3: |
| 11 |
} |
| 12 |
|
| 13 |
switch x { |
| 14 |
case 1, 2: //@ diag(`could use tagged switch on x`) |
| 15 |
case 3: |
| 16 |
default: |
| 17 |
} |
| 18 |
|
| 19 |
if x == 1 || x == 2 { |
| 20 |
} else if y == 3 { |
| 21 |
} else { |
| 22 |
} |
| 23 |
|
| 24 |
switch a { |
| 25 |
case x == y: //@ diag(`could use tagged switch on a`) |
| 26 |
case x != y: |
| 27 |
} |
| 28 |
|
| 29 |
switch z[0] { |
| 30 |
case 1, 2: //@ diag(`could use tagged switch on z[0]`) |
| 31 |
case 3: |
| 32 |
} |
| 33 |
|
| 34 |
for { |
| 35 |
switch x { |
| 36 |
case 1, 2: //@ diag(`could use tagged switch on x`) |
| 37 |
case 3: |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
for { |
| 42 |
if x == 1 || x == 2 { |
| 43 |
} else if x == 3 { |
| 44 |
break |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
if x == 1 || x == 2 { |
| 49 |
} |
| 50 |
} |