blob: 2b4b994e7e6ea2f82d26dc170362a929ef3b7d7c [file]
-- go.mod --
module example.com
go 1.27
-- a/a.go --
package main
type C struct{}
func (C) Foo[T any](x T) T { f(); return x }
func (C) Bar() { g() }
func f() {}
func g() {}
// Sink makes C a runtime type, so that its exported methods become
// potentially callable through reflection.
var Sink any
func main() {
var c C
c.Foo(1)
c.Foo("")
Sink = c
}
// WANT:
//
// edge main --static method call--> (C).Foo[int]
// edge main --static method call--> (C).Foo[string]
// edge (C).Foo[string] --static function call--> f
// edge (C).Foo[int] --static function call--> f
//
// reachable (C).Foo[int]
// reachable (C).Foo[string]
// reachable (C).Bar
// reachable f
// reachable g
// reachable init
// reachable main
//
// rtype C
// rtype *C