Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in v0.9.4: undefined selector Time #957

Closed
ldez opened this issue Nov 12, 2020 · 3 comments · Fixed by #958
Closed

Regression in v0.9.4: undefined selector Time #957

ldez opened this issue Nov 12, 2020 · 3 comments · Fixed by #958
Assignees
Labels
area/core bug Something isn't working
Milestone

Comments

@ldez
Copy link
Contributor

ldez commented Nov 12, 2020

I found a regression in Yaegi, it appeared in v0.9.4, it affects the plugin plugin-simplecache:

error: /tmp/pilot-gop211396919/src/github.com/traefik/plugin-simplecache/cache.go:12:2: import \"github.com/pquerna/cachecontrol\"
error: /tmp/pilot-gop211396919/src/github.com/traefik/plugin-simplecache/vendor/github.com/pquerna/cachecontrol/api.go:21:2: import \"github.com/pquerna/cachecontrol/cacheobject\"
error: /tmp/pilot-gop211396919/src/github.com/traefik/plugin-simplecache/vendor/github.com/pquerna/cachecontrol/cacheobject/object.go:255:32: undefined selector Time"

https://github.com/pquerna/cachecontrol/blob/master/cacheobject/object.go

v0.9.3...v0.9.4

related to traefik/plugin-simplecache#12

@nrwiersma
Copy link
Contributor

nrwiersma commented Nov 12, 2020

I am seeing the same thing when running test on gorilla websockets with yaegi v0.9.5.

$ yaegi test -unsafe ./
test: example_test.go:12:2: import "github.com/gorilla/websocket" error: client.go:54:29: undefined selector Conn

@mvertes mvertes self-assigned this Nov 13, 2020
@mvertes
Copy link
Member

mvertes commented Nov 13, 2020

I can reproduce it on a simplified case:

package main

import (
    "fmt"
    "time"
)

var t time.Time

func f() time.Time {
    time := t
    return time
}

func main() {
    fmt.Println(f())
}

@mvertes
Copy link
Member

mvertes commented Nov 13, 2020

Yaegi is confused about time symbol. Looks like a collision of name spaces between packages and variables.

mvertes added a commit that referenced this issue Nov 13, 2020
Perform function declaration type check from the global scope, to avoid
possible collisions of local variables with package names.

Fixes #957.
@mvertes mvertes added area/core bug Something isn't working labels Nov 13, 2020
@mvertes mvertes added this to the v0.9.x milestone Nov 13, 2020
traefiker pushed a commit that referenced this issue Nov 13, 2020
Perform function declaration type check from the upper level scope (the scope where the
function is declared), to avoid possible collisions of local variables with package names.

Fixes #957.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants