Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / go / pointer / testdata / another.go
1 // +build ignore
2
3 package main
4
5 var unknown bool
6
7 type S string
8
9 func incr(x int) int { return x + 1 }
10
11 func main() {
12         var i interface{}
13         i = 1
14         if unknown {
15                 i = S("foo")
16         }
17         if unknown {
18                 i = (func(int, int))(nil) // NB type compares equal to that below.
19         }
20         // Look, the test harness can handle equal-but-not-String-equal
21         // types because we parse types and using a typemap.
22         if unknown {
23                 i = (func(x int, y int))(nil)
24         }
25         if unknown {
26                 i = incr
27         }
28         print(i) // @types int | S | func(int, int) | func(int) int
29
30         // NB, an interface may never directly alias any global
31         // labels, even though it may contain pointers that do.
32         print(i)                 // @pointsto makeinterface:func(x int) int | makeinterface:func(x int, y int) | makeinterface:func(int, int) | makeinterface:int | makeinterface:main.S
33         print(i.(func(int) int)) // @pointsto main.incr
34
35         print() // regression test for crash
36 }