| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package fillswitch |
| 6 |
|
| 7 |
import altb "b" |
| 8 |
|
| 9 |
type typeA int |
| 10 |
|
| 11 |
const ( |
| 12 |
typeAOne typeA = iota |
| 13 |
typeATwo |
| 14 |
typeAThree |
| 15 |
) |
| 16 |
|
| 17 |
func doSwitch() { |
| 18 |
var a typeA |
| 19 |
switch a { |
| 20 |
} |
| 21 |
|
| 22 |
switch a { |
| 23 |
case typeAOne: |
| 24 |
} |
| 25 |
|
| 26 |
switch a { |
| 27 |
case typeAOne: |
| 28 |
default: |
| 29 |
} |
| 30 |
|
| 31 |
switch a { |
| 32 |
case typeAOne: |
| 33 |
case typeATwo: |
| 34 |
case typeAThree: |
| 35 |
} |
| 36 |
|
| 37 |
var b altb.TypeB |
| 38 |
switch b { |
| 39 |
case altb.TypeBOne: |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
type notification interface { |
| 44 |
isNotification() |
| 45 |
} |
| 46 |
|
| 47 |
type notificationOne struct{} |
| 48 |
|
| 49 |
func (notificationOne) isNotification() {} |
| 50 |
|
| 51 |
type notificationTwo struct{} |
| 52 |
|
| 53 |
func (notificationTwo) isNotification() {} |
| 54 |
|
| 55 |
func doTypeSwitch() { |
| 56 |
var not notification |
| 57 |
switch not.(type) { |
| 58 |
} |
| 59 |
|
| 60 |
switch not.(type) { |
| 61 |
case notificationOne: |
| 62 |
} |
| 63 |
|
| 64 |
switch not.(type) { |
| 65 |
case notificationOne: |
| 66 |
case notificationTwo: |
| 67 |
} |
| 68 |
|
| 69 |
switch not.(type) { |
| 70 |
default: |
| 71 |
} |
| 72 |
|
| 73 |
var t data.ExportedInterface |
| 74 |
switch t { |
| 75 |
} |
| 76 |
} |