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

Nested type definitions used in functions #1662

Open
Chicken935 opened this issue Sep 18, 2024 · 0 comments
Open

Nested type definitions used in functions #1662

Chicken935 opened this issue Sep 18, 2024 · 0 comments

Comments

@Chicken935
Copy link

The following program sample.go triggers an unexpected result

package main

func foo(barval Bar) {
	if barval.useExists() {
		println("is fee")
	} else {
		println("is not fee")
	}
}

func main() {
	barval := barimpl{true}
	foo(barval)
}

type Bar bar

type bar interface {
	useExists() bool
}

type barimpl struct {
	exists bool
}

func (r barimpl) useExists() bool {
	return r.exists
}

Expected result

$ go run ./sample.go
// exists

Got

$ yaegi ./sample.go
// panic: sample.go:4:5: CFG post-order panic: runtime error: index out of range [0] with length 0

Yaegi Version

v0.16.1

Additional Notes

Encountered this issue when trying to use this package: gopkg.in/inf.v0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant