Skip to content

Conversation

@mvertes
Copy link
Collaborator

@mvertes mvertes commented Feb 23, 2023

For methods defined on interfaces (vs concrete methods), the resolution of the method is necessarily delayed at the run time and can not be completed at compile time.

The selectorExpr processing has been changed to correctly identify calls on interface methods which were confused as fields rather than methods (due to the fact that in a interface definition, methods are fields of the interface).

Then at runtime, method lookup has been fixed to correctly recurse in nested valueInterface wrappers and to find embedded interface fields in case of struct or pointer to struct.

Finally, remove receiver processing in call().The receiver is already processed at method resolution and in genFunctionWrapper. Removing redundant processing in call fixes handling of variadic method, simplifies the code and makes it faster.

With those fixes, it is now possible to load and run go.uber.org/zap in yaegi. In turn, it makes possible for yaegi to run plugins dependent on zap, such as coraza-waf.

Fixes #1515,
Fixes #1172,
Fixes #1275,
Fixes #1485.

For methods defined on interfaces (vs concrete methods), the resolution
of the method is necessarily delayed at the run time and can not be
completed at compile time.

The selectorExpr processing has been changed to correctly identify
calls on interface methods which were confused as fields rather
than methods (due to the fact that in a interface definition, methods
are fields of the interface).

Then at runtime, method lookup has been fixed to correctly recurse in
nested valueInterface wrappers and to find embedded interface fields
in case of struct or pointer to structs.

Fixes traefik#1515.
@mvertes mvertes added this to the v0.15.x milestone Feb 23, 2023
@mvertes mvertes marked this pull request as draft February 23, 2023 14:18
@mvertes mvertes marked this pull request as ready for review February 24, 2023 09:12
The receiver is already processed at method resolution and in
genFunctionWrapper. Removing redundant processing in call
fixes handling of variadic method, simplifies the code and
makes it faster.

With this commit, it is now possible to run coraza-waf plugin
in traefik.
mvertes and others added 2 commits March 6, 2023 16:37
@mvertes mvertes deleted the fix-1515 branch March 6, 2023 15:48
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

3 participants