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 a missing implicit type conversion for binary expression #1654

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

mvertes
Copy link
Member

@mvertes mvertes commented Jul 29, 2024

When parsing binary operator expressions, make sure that implicit type conversions for untyped expressions are performed. It involves walking the sub-expression subtree at post-processing of binary expressions.

Fixes #1653.

When parsing binary operator expressions, make sure that implicit
type conversions for untyped expressions are performed. It involves
walking the sub-expression subtree at post-processing of binary
expressions.

Fixes traefik#1653.
@mvertes mvertes added bug Something isn't working area/core labels Jul 29, 2024
@mvertes mvertes added this to the v0.16.x milestone Jul 29, 2024
@mvertes mvertes requested a review from mpl July 29, 2024 12:45
Comment on lines +2310 to +2318
nod.Walk(func(n *node) bool {
if n == nod || (n.kind != binaryExpr && n.kind != parenExpr) || !n.typ.untyped {
return true
}
n.typ = nod.typ
if n.findex >= 0 {
sc.types[n.findex] = nod.typ.frameType()
}
return true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it ever implicitly return false?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A callback returning false terminates the tree walk. In our case, we just want to skip the node, but continue to process the rest of the expression subtree, looking for untyped expressions, so the callback always returns true.

@traefiker traefiker merged commit e686f55 into traefik:master Jul 30, 2024
12 checks passed
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.

reflect: call of reflect.Value.Uint on int Value
3 participants