| 1 |
package pkg |
| 2 |
|
| 3 |
import "fmt" |
| 4 |
|
| 5 |
func gen() interface{} { return nil } |
| 6 |
|
| 7 |
func fn(x, y interface{}) { |
| 8 |
switch z := x.(type) { |
| 9 |
case int: |
| 10 |
_ = z |
| 11 |
fmt.Println(x.(int)) |
| 12 |
} |
| 13 |
switch x.(type) { |
| 14 |
case int: |
| 15 |
fmt.Println(x.(int), y.(int)) |
| 16 |
} |
| 17 |
switch x.(type) { //@ diag(`assigning the result of this type assertion`) |
| 18 |
case int: |
| 19 |
fmt.Println(x.(int)) |
| 20 |
} |
| 21 |
switch x.(type) { |
| 22 |
case int: |
| 23 |
fmt.Println(x.(string)) |
| 24 |
} |
| 25 |
switch x.(type) { |
| 26 |
case int: |
| 27 |
fmt.Println(y.(int)) |
| 28 |
} |
| 29 |
switch (gen()).(type) { |
| 30 |
case int: |
| 31 |
fmt.Println((gen()).(int)) |
| 32 |
} |
| 33 |
} |