X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fgolang.org%2Fx%2Ftools%40v0.0.0-20201028153306-37f0764111ff%2Fgo%2Fpointer%2Ftestdata%2Fanother.go;fp=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fgolang.org%2Fx%2Ftools%40v0.0.0-20201028153306-37f0764111ff%2Fgo%2Fpointer%2Ftestdata%2Fanother.go;h=12ed690e99bbdc8b260092829237e7bdf0ce4b85;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hp=0000000000000000000000000000000000000000;hpb=b3950616b54221c40a7dab9099bda675007e5b6e;p=dotfiles%2F.git diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201028153306-37f0764111ff/go/pointer/testdata/another.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201028153306-37f0764111ff/go/pointer/testdata/another.go new file mode 100644 index 00000000..12ed690e --- /dev/null +++ b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201028153306-37f0764111ff/go/pointer/testdata/another.go @@ -0,0 +1,36 @@ +// +build ignore + +package main + +var unknown bool + +type S string + +func incr(x int) int { return x + 1 } + +func main() { + var i interface{} + i = 1 + if unknown { + i = S("foo") + } + if unknown { + i = (func(int, int))(nil) // NB type compares equal to that below. + } + // Look, the test harness can handle equal-but-not-String-equal + // types because we parse types and using a typemap. + if unknown { + i = (func(x int, y int))(nil) + } + if unknown { + i = incr + } + print(i) // @types int | S | func(int, int) | func(int) int + + // NB, an interface may never directly alias any global + // labels, even though it may contain pointers that do. + print(i) // @pointsto makeinterface:func(x int) int | makeinterface:func(x int, y int) | makeinterface:func(int, int) | makeinterface:int | makeinterface:main.S + print(i.(func(int) int)) // @pointsto main.incr + + print() // regression test for crash +}