-
Notifications
You must be signed in to change notification settings - Fork 356
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 not being interpreted #1227
Comments
traefiker
pushed a commit
that referenced
this issue
Sep 6, 2021
This test (assert2.go) display 2 separate issues: 1. assert2.go L28: Type assert tries to set an `interface{}` to a `valueInterface`. The typing here is complex, we have a valueT(strings.Builder) wrapped in a ptrT wrapped in a src iface wrapped in a valueT(interface{}). Type assert fails to realise that the `valueT` `interface{}` is wrapping the `valueInterface`. 2. assert2.go L29: `genValueBinMethodOnInterface` does not try and get the bin method, as the `typ.node` (`ptrT` or a `valueT`(`string.Builder`)) is set. In this case the src iface is called with a receiver argument. To fix this the method is looked for first if possible, and only if not found does it fall back to the `defaultGen`. Fixes #1227
Bai-Yingjie
pushed a commit
to godevsig/yaegi
that referenced
this issue
Sep 12, 2021
This test (assert2.go) display 2 separate issues: 1. assert2.go L28: Type assert tries to set an `interface{}` to a `valueInterface`. The typing here is complex, we have a valueT(strings.Builder) wrapped in a ptrT wrapped in a src iface wrapped in a valueT(interface{}). Type assert fails to realise that the `valueT` `interface{}` is wrapping the `valueInterface`. 2. assert2.go L29: `genValueBinMethodOnInterface` does not try and get the bin method, as the `typ.node` (`ptrT` or a `valueT`(`string.Builder`)) is set. In this case the src iface is called with a receiver argument. To fix this the method is looked for first if possible, and only if not found does it fall back to the `defaultGen`. Fixes traefik#1227
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following program
sample.go
triggers an unexpected resultExpected result
it should at least compile
Got
It's some issue with sync.Pool{} which takes New(...) interface{} from repo github.com/antchfx/xpath (func.go)
Yaegi Version
devel (latest)
Additional Notes
I see Interfaces to be used from the pre-compiled code can not be added dynamically, as it is required to pre-compile interface wrappers. in the readme, is there any workaround or any way I can fix this?
Thank you
The text was updated successfully, but these errors were encountered: