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

interp: fix type assertion for wrapped empty interface #1467

Merged
merged 3 commits into from
Oct 3, 2022

Conversation

mvertes
Copy link
Member

@mvertes mvertes commented Oct 3, 2022

Although empty interfaces are usually not wrapped, for compatibility with the runtime, we may have to wrap them sometime into valueInterface type.

It allows to preserve interpreter type metadata for interface values exchanged with the runtime. It is necessary to resolve methods and receivers in the absence of reflect support.

During type assertions on empty interfaces, we now handle a possible valueInterface and dereference the original value to pursue the type assertion.

In the same change, we have improved the format of some panic messages at runtime to give location of offending source at interpreter level.

This change will allow to fix traefik/traefik#9362.

Although empty interfaces are usually not wrapped, for compatibility
with the runtime, we may have to wrap them sometime into `valueInterface`
type.

It allows to preserve interpreter type metadata for interface values
exchanged with the runtime. It is necessary to resolve methods and
receivers in the absence of reflect support.

During type assertions on empty interfaces, we now handle a possible
valueInterface and dereference the original value to pursue the type
assertion.

In the same change, we have improved the format of some panic messages
at runtime to give location of offending source at interpreter level.

This change will allow to fix traefik/#9362.
@mvertes mvertes added area/core bug Something isn't working labels Oct 3, 2022
@mvertes mvertes added this to the v0.14.x milestone Oct 3, 2022
@mvertes mvertes requested a review from mpl October 3, 2022 08:37
_test/cli7.go Outdated Show resolved Hide resolved
Co-authored-by: mpl <mathieu.lonjaret@gmail.com>
_test/cli7.go Outdated Show resolved Hide resolved
Co-authored-by: mpl <mathieu.lonjaret@gmail.com>
@traefiker traefiker merged commit 143e4a4 into traefik:master Oct 3, 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 this pull request may close these issues.

panic when using local plugin mode
3 participants