Debian Codegraph @

go/ssa/testdata/fixedbugs/issue78110.go

raw symbols SCIP
1 // This program used to cause the builder to emit Next instructions
2 // with types based on the (k, v) variables and not the iterated map
3 // (cases 1 and 2 of issue 78110) due to the implicit interface
4 // conversion in the assignment from iterator value to variable.
5 // The sanity pass now checks that their types are identical.
6
7 package issue78110
8
9 func rangeConcreteMap() {
10 var v any
11 for _, v = range map[int]int{} {
12 _ = v
13 }
14 }
15
16 func rangeInterfaceMap() {
17 var v any
18 for _, v = range map[int]interface{ M() }{} {
19 _ = v
20 }
21 }
22
23 type I interface{ M() }
24 type J interface {
25 I
26 N()
27 }
28
29 func boundMethodClosure(j J) {
30 _ = j.M
31 }