diff options
Diffstat (limited to 'go/pointer/testdata/funcreflect.go')
-rw-r--r-- | go/pointer/testdata/funcreflect.go | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/go/pointer/testdata/funcreflect.go b/go/pointer/testdata/funcreflect.go index a0a9a5faa..2b4315ba5 100644 --- a/go/pointer/testdata/funcreflect.go +++ b/go/pointer/testdata/funcreflect.go @@ -1,3 +1,4 @@ +//go:build ignore // +build ignore package main @@ -8,7 +9,7 @@ var zero, a, b int var false2 bool func f(p *int, q hasF) *int { - print(p) // @pointsto main.a + print(p) // @pointsto command-line-arguments.a print(q) // @types *T print(q.(*T)) // @pointsto new@newT1:22 return &b @@ -26,10 +27,10 @@ func reflectValueCall() { reflect.ValueOf(&a), }) print(res[0].Interface()) // @types *int - print(res[0].Interface().(*int)) // @pointsto main.b + print(res[0].Interface().(*int)) // @pointsto command-line-arguments.b } -// @calls main.reflectValueCall -> main.f +// @calls command-line-arguments.reflectValueCall -> command-line-arguments.f func reflectValueCallIndirect() { rvf := reflect.ValueOf(g) @@ -45,14 +46,14 @@ func reflectValueCallIndirect() { }) res0 := res[0].Interface() print(res0) // @types *int | *bool | *T - print(res0.(*int)) // @pointsto main.b - print(res0.(*bool)) // @pointsto main.false2 + print(res0.(*int)) // @pointsto command-line-arguments.b + print(res0.(*bool)) // @pointsto command-line-arguments.false2 print(res0.(hasF)) // @types *T print(res0.(*T)) // @pointsto new@newT2:19 } -// @calls main.reflectValueCallIndirect -> (reflect.Value).Call$bound -// @calls (reflect.Value).Call$bound -> main.g +// @calls command-line-arguments.reflectValueCallIndirect -> (reflect.Value).Call$bound +// @calls (reflect.Value).Call$bound -> command-line-arguments.g func reflectTypeInOut() { var f func(float64, bool) (string, int) @@ -94,17 +95,17 @@ func reflectTypeMethodByName() { F, _ := TU.MethodByName("F") print(reflect.Zero(F.Type)) // @types func(T) | func(U, int) - print(F.Func) // @pointsto (main.T).F | (main.U).F + print(F.Func) // @pointsto (command-line-arguments.T).F | (command-line-arguments.U).F g, _ := TU.MethodByName("g") print(reflect.Zero(g.Type)) // @types func(T, int) | func(U, string) - print(g.Func) // @pointsto (main.T).g | (main.U).g + print(g.Func) // @pointsto (command-line-arguments.T).g | (command-line-arguments.U).g // Non-literal method names are treated less precisely. U := reflect.TypeOf(U{}) X, _ := U.MethodByName(nonconst) print(reflect.Zero(X.Type)) // @types func(U, int) | func(U, string) - print(X.Func) // @pointsto (main.U).F | (main.U).g + print(X.Func) // @pointsto (command-line-arguments.U).F | (command-line-arguments.U).g // Interface methods. rThasF := reflect.TypeOf(new(hasF)).Elem() @@ -118,7 +119,7 @@ func reflectTypeMethodByName() { func reflectTypeMethod() { m := reflect.TypeOf(T{}).Method(0) print(reflect.Zero(m.Type)) // @types func(T) | func(T, int) - print(m.Func) // @pointsto (main.T).F | (main.T).g + print(m.Func) // @pointsto (command-line-arguments.T).F | (command-line-arguments.T).g } func main() { |