| 1 |
Regression test for #62667: the callee's reference to Split |
| 2 |
was blindly qualified to path.Split even though the imported |
| 3 |
PkgName path is shadowed by the parameter of the same name. |
| 4 |
|
| 5 |
The defer is to defeat reduction of the call and |
| 6 |
substitution of the path parameter by g(). |
| 7 |
|
| 8 |
-- go.mod -- |
| 9 |
module testdata |
| 10 |
go 1.12 |
| 11 |
|
| 12 |
-- a/a.go -- |
| 13 |
package a |
| 14 |
|
| 15 |
import "testdata/path" |
| 16 |
|
| 17 |
func A() { |
| 18 |
path.Dir(g()) //@ inline(re"Dir", result) |
| 19 |
} |
| 20 |
|
| 21 |
func g() string |
| 22 |
|
| 23 |
-- path/path.go -- |
| 24 |
package path |
| 25 |
|
| 26 |
func Dir(path string) { |
| 27 |
defer func(){}() |
| 28 |
Split(path) |
| 29 |
} |
| 30 |
|
| 31 |
func Split(string) {} |
| 32 |
|
| 33 |
-- result -- |
| 34 |
package a |
| 35 |
|
| 36 |
import path0 "testdata/path" |
| 37 |
|
| 38 |
func A() { |
| 39 |
func() { var path string = g(); defer func() {}(); path0.Split(path) }() //@ inline(re"Dir", result) |
| 40 |
} |
| 41 |
|
| 42 |
func g() string |