| 1 |
package pkg |
| 2 |
|
| 3 |
func foo() int { return 0 } |
| 4 |
|
| 5 |
func fn1() { |
| 6 |
var x, y int |
| 7 |
var z map[string][]int |
| 8 |
var a bool |
| 9 |
|
| 10 |
switch { //@ diag(`could use tagged switch on x`) |
| 11 |
case x == 4: // comment |
| 12 |
case x == 1 || x == 2, x == 3: |
| 13 |
} |
| 14 |
|
| 15 |
switch { //@ diag(`could use tagged switch on x`) |
| 16 |
case x == 1 || x == 2, x == 3: |
| 17 |
case x == 4: |
| 18 |
default: |
| 19 |
} |
| 20 |
|
| 21 |
switch { //@ diag(`could use tagged switch on z[""][0]`) |
| 22 |
case z[""][0] == 1 || z[""][0] == 2: |
| 23 |
} |
| 24 |
|
| 25 |
switch { //@ diag(`could use tagged switch on a`) |
| 26 |
case a == (x == y) || a == (x != y): |
| 27 |
} |
| 28 |
|
| 29 |
switch { |
| 30 |
case z[""][0] == 1 || z[""][1] == 2: |
| 31 |
} |
| 32 |
|
| 33 |
switch { |
| 34 |
case x == 1 || x == 2, y == 3: |
| 35 |
case x == 4: |
| 36 |
default: |
| 37 |
} |
| 38 |
|
| 39 |
switch { |
| 40 |
case x == 1 || x == 2, x == 3: |
| 41 |
case y == 4: |
| 42 |
} |
| 43 |
|
| 44 |
switch { |
| 45 |
case x == 1 || x == 2, x == foo(): |
| 46 |
case x == 4: |
| 47 |
default: |
| 48 |
} |
| 49 |
|
| 50 |
switch { |
| 51 |
} |
| 52 |
|
| 53 |
switch { |
| 54 |
default: |
| 55 |
} |
| 56 |
|
| 57 |
switch { |
| 58 |
case x == 1 && x == 2: |
| 59 |
} |
| 60 |
|
| 61 |
switch b := 42; { //@ diag(`could use tagged switch on b`) |
| 62 |
case b == 0: |
| 63 |
case b == 1: |
| 64 |
default: |
| 65 |
_ = b |
| 66 |
} |
| 67 |
} |