Skip to content

[pull] master from GaijinEntertainment:master#1025

Merged
pull[bot] merged 4 commits into
forksnd:masterfrom
GaijinEntertainment:master
May 22, 2026
Merged

[pull] master from GaijinEntertainment:master#1025
pull[bot] merged 4 commits into
forksnd:masterfrom
GaijinEntertainment:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 22, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

borisbat and others added 4 commits May 22, 2026 08:28
…ablePeeling

`$e(...)` in `qmacro`/`qmacro_block`/`qmacro_expr`/`qmacro_block_to_array`
now substitutes peel-aware in BOTH bare-var and ExprRef2Value-wrapped
contexts via a single rule table (`var2expr`). The split between
`replaceVariable` (non-peel) and `replaceVariablePeeling` (wrapped-only)
collapses to a single route:

  * `var2exprPeeling` field → DELETED
  * `replaceVariablePeeling` function → DELETED
  * `TemplateVisitor.visitExprVar`: substitutes from `var2expr`, gated by
    `in_r2v_wrapper == 0` so the wrapper visit takes precedence when
    present
  * `TemplateVisitor.visitExprRef2Value`: now consults `var2expr` (was
    `var2exprPeeling`) — wrapped form strips the wrapper as part of
    substitution

`in_r2v_wrapper` is a depth counter incremented in `preVisitExprRef2Value`,
decremented in the post-visit. Symmetric, handles nesting.

Sole caller of `replaceVariablePeeling` (ast_match.das:2263 in
`peel_lambda_replace_var`) migrated to `replaceVariable`; docstring updated
to reflect the unified peel semantics.

Aligns qmacro substitution with qmatch's "post-infer AST always wants
peeling" convention — pre-infer call sites (no wrapper) and post-infer
call sites (typer-inserted wrapper) both work through the same name
without per-site decision.

Validation: 5287 tests green across tests/template, tests/ast_match,
tests/linq, tests/decs, tests/dasSQLITE, tests/macro_call,
tests/macro_boost, tests/language, tests/gc, tests/daslib, tests/lint,
tests/json, tests/dasPUGIXML, tests/strings, utils/lint/tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot review on PR #2817 caught a real bug: the original
``in_r2v_wrapper`` gate suppressed visitExprVar substitutions under ANY
ExprRef2Value, but visitExprRef2Value's peel-and-substitute only fires
when ``subexpr is ExprVar``. So nested shapes like
``ExprRef2Value(ExprField(ExprVar(temp), "f"))`` lost the substitution
on the inner var (the wrapper sat over a field access, not directly the
var, so the peel didn't fire — and the bare-var rule was gated off).

Fix: only increment the depth counter when the wrapper's direct subexpr
IS an ExprVar. The post-visit decrement matches the same condition.
Renamed counter to ``in_r2v_direct_var`` for clarity. The narrow gate
preserves the original "wrapper visit takes precedence" semantics for
the peelable shape while letting visitExprVar substitute normally for
all other shapes.

Adds tests/template/test_apply_template_peel.das with 4 regression cases
covering the unified peel substitution surface:
  1. Bare ExprVar — substitutes via visitExprVar
  2. R2V(ExprVar) — wrapper stripped, substitutes via visitExprRef2Value
  3. R2V(ExprField(ExprVar)) — substitutes inside, wrapper preserved
  4. R2V(ExprVar) with no matching rule — passes through unchanged

Verified: case 3 fails on the pre-fix gate (incorrectly suppresses the
substitution); passes after the fix.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…lane

`qmacro(REPLACEMENT)` expands to `ExprQuote(REPLACEMENT)` which the LLVM
JIT does not lower (pre-existing regression on master — see
feedback_master_jit_quote_regression). Construct the replacement var
directly via `new ExprVar(at = LineInfo(), name := "REPLACEMENT")` to
keep all 4 regression tests passing across interp, AOT, and JIT lanes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…el-by-default

templates_boost: unify $e splice on peel-by-default; drop replaceVariablePeeling
@pull pull Bot locked and limited conversation to collaborators May 22, 2026
@pull pull Bot added the ⤵️ pull label May 22, 2026
@pull pull Bot merged commit df3e91b into forksnd:master May 22, 2026
@pull pull Bot had a problem deploying to github-pages May 22, 2026 20:58 Error
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant