1
2
3
4
5
6
7
8
9
10 package main
11
12 import (
13 "fmt"
14
15 ssa1 "issue29612.dir/p1/ssa"
16 ssa2 "issue29612.dir/p2/ssa"
17 )
18
19 func main() {
20 v1 := &ssa1.T{}
21 _ = v1
22
23 v2 := &ssa2.T{}
24 ssa2.Works(v2)
25 ssa2.Panics(v2)
26
27 swt(v1, 1)
28 swt(v2, 2)
29 }
30
31
32 func swt(i interface{}, want int) {
33 var got int
34 switch i.(type) {
35 case *ssa1.T:
36 got = 1
37 case *ssa2.T:
38 got = 2
39
40 case int8, int16, int32, int64:
41 got = 3
42 case uint8, uint16, uint32, uint64:
43 got = 4
44 }
45
46 if got != want {
47 panic(fmt.Sprintf("switch %v: got %d, want %d", i, got, want))
48 }
49 }
50
View as plain text