Source file
test/fixedbugs/issue26094.go
1
2
3
4
5
6
7 package main
8
9 import "strings"
10
11 var X interface{}
12
13 type T struct{}
14
15 func scopes() {
16 p, ok := recover().(error)
17 if ok && strings.Contains(p.Error(), "different scopes") {
18 return
19 }
20 panic(p)
21 }
22
23 func F1() {
24 type T struct{}
25 X = T{}
26 }
27
28 func F2() {
29 type T struct{}
30 defer scopes()
31 _ = X.(T)
32 }
33
34 func F3() {
35 defer scopes()
36 _ = X.(T)
37 }
38
39 func F4() {
40 X = T{}
41 }
42
43 func main() {
44 F1()
45 F2()
46 F3()
47 F4()
48 F2()
49 }
50
View as plain text