Skip to content

layout: multi-word lambda params in page attributes and repeated call arguments - #3630

Merged
BaseMax merged 1 commit into
mainfrom
fix/fa-ui-test-gaps
Nov 18, 2026
Merged

BaseMax merged 1 commit into
mainfrom
fix/fa-ui-test-gaps

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

The Persian twins of the tests from #3626 failed on main (ui fa input_push_reset, ui fa input_clear_bound, page fa method_arg_in_each). Two real compiler gaps and one bad test.

  • The layout lexer decided whether ( starts a lambda by looking for one identifier then :. A multi-word Persian parameter such as (مقدار تازه: رشته) was not recognised, so the lambda body was lexed as layout attributes and failed with "expected an expression near ...". The header check now accepts several words before the colon.
  • Layout expansion substituted a component argument that is a call (names.بگیر(ی)) straight into every place the parameter is used, so one node was checked twice and its Persian method name was reported as an English identifier. Calls are now cloned per use, and rebuilt member/call nodes keep their written-name aliases.
  • tests/fa/ui/input_clear_bound used two-word function names as click handlers, which the layout reads as an attribute. Renamed to single words.

Examples

input: id = "name" type = "text" value = نوشته ورودی = (مقدار تازه: رشته):
    نوشته = مقدار تازه
پایان پایان

حباب: کی = نام‌ها.بگیر(ی) متن = سطر پایان

Tested with a compiler built from this branch: ui fa input_push_reset, input_clear_bound; page fa/en components/method_arg_in_each. ui events_bubble, events_rows, vars_classify fa stay in the known list.

Summary by CodeRabbit

  • Bug Fixes
    • Parenthesized lambda headers now accept multiple parameter names before the terminating colon.
    • Improved expression handling when substituting values, including bound calls and aliases. This helps preserve expression behavior in affected cases.

@BaseMax
BaseMax requested a review from a team as a code owner November 18, 2026 01:33
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The changes update parenthesized lambda-header scanning and AST substitution. The bound-input test also renames its clear and fill handlers and updates the corresponding button references.

Changes: Compiler layout and bound UI handlers

Layer / File(s) Summary
Scan parenthesized lambda headers
compiler/lexer/lexer_layout.salam
The scanner skips subsequent identifiers, spaces, and tabs before checking for the terminating colon.
Preserve bound calls and aliases
compiler/sal_layout/layout_expand.salam, tests/fa/ui/input_clear_bound.salam
subst_value clones bound AST calls. Rebuilt expression nodes retain their aliases. The test renames its clear and fill handlers and updates the button references.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • SalamLang/Salam#3626: It changes overlapping lambda-parameter and method-call handling and covers the same bound-input test.

Suggested reviewers: bdadmehr0

Merge Risk: Minimal · up to eb6d4

The change lets multi-word lambda parameters work in page attributes and keeps method names intact when an argument is used more than once. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names two of the three changes in the PR: multi-word lambda parameters in page attributes and the repeated call argument handling in layout expansion. It omits the test rename, which is a mi…
Description check Passed The description follows the template sections (Description, Related Issue, Proposed Changes, How Was This Tested, Additional Notes). It explains the three fixes and gives a code example and the test r…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names two of the three changes in the PR: multi-word lambda parameters in page attributes and the repeated call argument handling in layout expansion. It omits the test rename, which is a minor part. The title is specific and matches the main changes, so it passes.

Full details: Description check

Explanation

The description follows the template sections (Description, Related Issue, Proposed Changes, How Was This Tested, Additional Notes). It explains the three fixes and gives a code example and the test runs. Gaps: no explicit 'Related Issue' reference beyond the mention of #3626, no 'Closes' keyword, the Proposed Changes section is not in the template's bullet form, and the checklist is absent. The description is mostly complete, so it passes. The author should add a Related Issue line and tick or address the checklist items.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c11dd92f-0d50-44b1-baf7-8e31865c628b
Commits

Reviewing files that changed from the base of the PR and between a9e0e03 and eb6d49d.

Files selected for processing: 3

  • compiler/lexer/lexer_layout.salam
  • compiler/sal_layout/layout_expand.salam
  • tests/fa/ui/input_clear_bound.salam

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor
sha=eb6d49d0cd3c3d7929d9e8edbbb25506bbe7023a

🤖 Salam AI review

Verdict: ✅ Good to merge

commit eb6d49d · 3 files · +14 −5 · model salam

Summary

This pull request fixes two layout compiler gaps and corrects a Persian UI test. It makes lambda headers in layout attributes accept multi-word parameters, and it clones call-valued component arguments while preserving written-name aliases during layout expansion. The affected test is also updated to use single-word handler names.

What changed

The layout lexer now consumes additional identifier words before the colon in an embedded lambda header, so Persian parameters such as (مقدار تازه: رشته) are recognized. Layout expansion now clones AST nodes when a substituted value is a call, preventing one node from being checked twice, and rebuilt nodes copy their aliases. The Persian input_clear_bound test renames two-word click handlers to single-word names.

Review

  • compiler/lexer/lexer_layout.salam: the added branch is placed after whitespace handling and consumes a complete identifier before continuing, which matches the existing single-word path and supports spaced multi-word parameters. No blocking issue is visible in the diff.
  • compiler/sal_layout/layout_expand.salam: adding at.AST_CALL to the clone condition addresses the reported repeated-use problem for call arguments such as names.بگیر(ی). The alias-copy loop preserves written names on rebuilt member and call nodes.
  • tests/fa/ui/input_clear_bound.salam: renaming پاک کردن and پر کردن to خالی and پرشدن avoids layout attribute parsing ambiguity for click handlers. The diff updates both definitions and uses.

Tests

The PR states that ui fa input_push_reset, ui fa input_clear_bound, and page fa/en components/method_arg_in_each were exercised with a compiler built from the branch. The diff itself does not include those test results, so this is taken from the PR description.

Risks

The main residual risk is that other callers of the renamed test handlers, if any outside the shown diff, would need the same rename. The compiler changes are narrowly scoped to lambda header scanning and call cloning, so broader layout behavior should be unaffected.


⚠️ This review was written automatically by an AI and may contain mistakes. It is a helper for maintainers, not a replacement for a human review: check the code yourself before merging.

@BaseMax
BaseMax merged commit 26574a9 into main Nov 18, 2026
22 checks passed
@BaseMax
BaseMax deleted the fix/fa-ui-test-gaps branch November 18, 2026 01:51
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.

1 participant