mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
The current `nodeType` selector precedence is heavy handed in favour of package type. It seems to often create `typeSym` symbols as variable types in the scope will never be found. To fix this if the ancestor node is a field expression, the package type is searched for. After this, if the type is still `nil` the normal scope is searched using `nodeType2`. Fixes #1158
29 lines
342 B
Go
29 lines
342 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func test(time string, t time.Time) string {
|
|
return time
|
|
}
|
|
|
|
var zero = time.Time{}
|
|
|
|
func test2(time string) time.Time {
|
|
return zero
|
|
}
|
|
|
|
func main() {
|
|
str := test("test", time.Now())
|
|
fmt.Println(str)
|
|
|
|
str2 := test2("test2")
|
|
fmt.Println(str2)
|
|
}
|
|
|
|
// Output:
|
|
// test
|
|
// 0001-01-01 00:00:00 +0000 UTC
|