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

interface variable redefinition in a block #1404

Closed
mvertes opened this issue May 24, 2022 · 0 comments · Fixed by #1405
Closed

interface variable redefinition in a block #1404

mvertes opened this issue May 24, 2022 · 0 comments · Fixed by #1405
Labels
area/core bug Something isn't working
Milestone

Comments

@mvertes
Copy link
Member

mvertes commented May 24, 2022

The following program sample.go triggers an unexpected result

package main

type I interface {
    inI()
}

type T struct {
    name string
}

func (t *T) inI() {}

func main() {
    var i I = &T{name: "foo"}

    if i, ok := i.(*T); ok {
        println(i.name)
    }   
}

Expected result

$ go run ./sample.go
foo

Got

$ yaegi ./sample.go 
run: ./sample.go:17:11: undefined selector: name

Yaegi Version

v0.12.0

Additional Notes

No response

@mvertes mvertes added bug Something isn't working area/core labels May 24, 2022
@mvertes mvertes added this to the v0.12.x milestone May 24, 2022
mvertes added a commit to mvertes/yaegi that referenced this issue May 24, 2022
traefiker pushed a commit to mvertes/yaegi that referenced this issue Jun 13, 2022
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.

1 participant