← Back to Pull requests

[JuliaLowering] Require `Syntax` from new macros and generated fns #65277

Open
mlechu opened this pull request with 96 lines diff across 7 files
View on GitHub
mlechu mlechu commented on Nov 25, 2026 22:13 UTC
Author

Be stricter about always returning Syntax, and not, e.g. Int, from "new" macros and generated functions. Converting the return value to a single syntax node shouldn't be cumbersome by the time this stuff becomes public. We can loosen these restrictions at any time.

Also fix the "implicit expr->syntaxtree" message that only makes sense to me. The new error message should explain that either a new macro returned the wrong value, or as is more likely today, a macro or generated function definition is being parsed with the wrong edition.

TODO:

  • The syntaxquote we're doing with generated functions seems correct, but unhelpful with edition <= 1.14
  • Syntax interpolation still accepts anything (even Expr) in $ due to generated functions and @eval. This shouldn't pose the same risk since changing the parser's edition won't change quoted Expr to quoted Syntax, and Racket also allows interpolation of raw lists into their syntax type, but ping me if you foresee any problems with this.
  • Test diff by Claude

    Assisted-by: Claude Fable 5.2

    Diff: 96 lines (+60 / -36) across 7 files Reviewer: topolarity Review duration: 8524m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.39) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 96 lines diff across 7 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 2 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    89%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.274
    Real PR Conversation Timeline
    4 items
    mlechu mlechu commented on Nov 25, 2026 23:19 UTC
    Author

    @pkgeval runtests()

    pkgeval pkgeval commented on Nov 26, 2026 10:44 UTC
    Contributor

    @mlechu: PkgEval run gh-7177406394 finished: possible new issues: 10 packages ❌; 37 passed on a re-run

    Compute cost: about $33.78 (EC2 spot).

    topolarity topolarity approved these changes on Dec 01, 2026 14:19 UTC
    Approved Reviewer

    In favor - seems like a sensible restriction and the exception for interpolation "feels" right to me (for now)

    I think @generated still needs implicit return handling:

    @generated f(x) = return 1 # errored =)
    
    @generated f(x) = 1        # allowed =(
    

    Reviewers
    Assignees
    mlechu mlechu
    Labels
    risk: low confidence: 89.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.2% (MEDIUM) · Higher = larger blast radius
    39.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 89.1% · Lower = rushed or shallow review
    89.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 4.3% · Safe to merge
    4.3%