3 // Copyright 2017 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
16 return "Hello World" // line 16
19 func foo() string { // line 19
20 x := hello() // line 20
21 y := hello() // line 21
22 return x + y // line 22
26 x := hello() // line 26
30 // funcPC returns the PC for the func value f.
31 func funcPC(f interface{}) uintptr {
32 return reflect.ValueOf(f).Pointer()
35 // Test for issue #15453. Previously, line 26 would appear in foo().
38 f := runtime.FuncForPC(pc)
39 for ; runtime.FuncForPC(pc) == f; pc++ {
40 file, line := f.FileLine(pc)
44 // Line 16 can appear inside foo() because PC-line table has
45 // innermost line numbers after inlining.
46 if line != 16 && !(line >= 19 && line <= 22) {
47 log.Fatalf("unexpected line at PC=%d: %s:%d\n", pc, file, line)