# Test of -whylive with reflective call
# (regression test for golang/go#67915).

# The live function is reached via reflection:

 deadcode example.com
 want "unreachable func: dead"
!want "unreachable func: live"

# Reflective calls have Edge.Site=nil, which formerly led to a crash
# when -whylive would compute its position. Now it has NoPos.

 deadcode -whylive=example.com.live example.com
 want "                  example.com.main"
 want " static@L0006 --> reflect.Value.Call"
 want "dynamic@L0000 --> example.com.live"

-- go.mod --
module example.com
go 1.18

-- main.go --
package main

import "reflect"

func main() {
	reflect.ValueOf(live).Call(nil)
}

func live() {
	println("hello")
}

func dead() {
	println("goodbye")
}
