Repository navigation
fix: reject rest parameters in callback lambdas - #234
DevChiniwala wants to merge 1 commit into
Conversation
Reject rest parameters in expression arrow lambdas before their argument collection semantics are lost. Preserve named variadic declaration metadata, document the boundary, and cover unsupported and supported callback forms with regressions.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
This seems rather reasonable, but still wondering whether we can support rather than reject? |
|
Yes, it is feasible, but it needs argument collection at the callback call site. For The sound follow-up is to preserve the rest binding in the lambda IR and construct its actual argument array in both backends. Its regression should verify |
An inline arrow callback's rest parameter currently loses its
...marker during extraction. The backends receive an ordinary parameter instead of an array collecting the callback arguments. This can verify a false JavaScript postcondition:JavaScript returns
[3]:mappasses the element, index, and source array. On unchanged maindd0847e, the generated Dafny instead bindsargsto the element[7], giving length 1. The real CLI verifies the false postcondition with 3 verified, 0 errors, without proof additions or assumptions.Reject rest parameters in expression arrow lambdas during extraction with an explicit diagnostic, and document the unsupported boundary. Ordinary callback parameters and object destructuring remain supported. Named variadic function declarations and top-level arrow declarations retain their existing rest-grouping metadata.
Validation:
Prepared with Codex assistance. The source runtime result, false proof on main, and passing-after checks were executed locally and inspected.