Skip to content

Specialize receiver varargs fallback#934

Open
snazy wants to merge 2 commits into
projectnessie:mainfrom
snazy:speci-rec-va-cb
Open

Specialize receiver varargs fallback#934
snazy wants to merge 2 commits into
projectnessie:mainfrom
snazy:speci-rec-va-cb

Conversation

@snazy

@snazy snazy commented Jul 23, 2026

Copy link
Copy Markdown
Member

Route unresolved varargs calls through a receiver-specific evaluator that avoids building the full argument array before receiver dispatch.

Also pass the complete receiver tail to dynamic receivers and cover unchecked receiver varargs calls with multiple arguments.

Route unresolved varargs calls through a receiver-specific evaluator that avoids building the full argument array before receiver dispatch.

Also pass the complete receiver tail to dynamic receivers and cover unchecked receiver varargs calls with multiple arguments.
@snazy
snazy requested a review from XN137 July 23, 2026 07:47
Comment thread core/src/main/java/org/projectnessie/cel/interpreter/Interpretable.java Outdated
if (arg0.type().hasTrait(Trait.ReceiverType)) {
return ((Receiver) arg0).receive(function, overload, tailArgs);
}
return noSuchOverload(arg0, function, overload, tailArgs);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the existing EvalVarArgs calls this with all arguments, not just the tail:
https://github.com/snazy/cel-java/blob/f130b4db348f23e019d98b08fe21a41d7dce620e/core/src/main/java/org/projectnessie/cel/interpreter/Interpretable.java#L764C1-L764C37
is this intentional or would this produce different errors?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, this produces a different error message, and that's intentional.
arg0 is already passed separately to noSuchOverload() as the receiver, so including it again in args duplicates the receiver type in the rendered signature.
Passing only tailArgs is consistent with EvalUnary, EvalBinary, and Receiver.receive().
The existing EvalVarArgs behavior looks inconsistent here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok i thought this is outside the "arg0 is receiver" branch, but if the inconsistency with EvalVarArgs is fine, then ok

@snazy
snazy requested a review from XN137 July 23, 2026 17:24
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

Successfully merging this pull request may close these issues.

2 participants