Skip to content

Lower preprocessing macro calls before the canonical WIR boundary #85

Description

@Teakowa

Goal

Ensure supported OverPy preprocessing and macro semantics are fully resolved inside opy-rs before lowering reaches canonical Workshop WIR.

Context

Wright PR wrightkit/wright#228 consumes the released opy-rs / opy-compiler 0.1.3 owner contracts as part of the source-language ownership cutover.

Its current OPY integration evidence exposes an owner-side gap in the existing synthetic/preprocessing regression fixture:

#!include "shared.opy"

rule "preprocessing":
    @Event global
    debug(double(Phase.FINISHED))

Compilation currently fails with:

unsupported-integration-surface: expression 'macroCall' is not currently representable in canonical WIR

The same failure also aborts Wright's benchmark fixture execution. This is not a Wright integration-layer semantic responsibility: OPY preprocessing/macros are owned by opy-rs, and macro-only intermediate forms must not leak into the canonical Workshop boundary.

Related: #8
Blocks: wrightkit/wright#228

Scope

  • Reproduce the preprocessing/macro failure against the released/public OPY compile path.
  • Ensure supported macro calls are resolved to their semantic result before canonical WIR lowering.
  • Preserve source-attributed diagnostics/provenance when preprocessing or macro expansion fails.
  • Cover the representative include + macro-call path that currently reaches macroCall at the WIR boundary.
  • Verify the fix through the public compile contract consumed by Wright.

Non-goals

  • No Wright-side fallback or duplicated preprocessing/macro semantics.
  • No new WrightKit-only OverPy syntax.
  • No requirement for compiler-output/text identity with upstream OverPy.
  • No broad macro-system redesign beyond the capability demonstrated by the failing integration evidence.
  • Do not weaken or remove the downstream regression to make the gate pass.

Acceptance criteria

  • The representative #!include + double(Phase.FINISHED) fixture compiles successfully through the public OPY compile path into canonical WIR/Workshop emission.
  • No macroCall or equivalent preprocessing-only representation reaches a canonical WIR boundary for that supported path.
  • Invalid/failed preprocessing remains a structured, source-attributed OPY diagnostic rather than a generic downstream integration failure.
  • Owner-side regression coverage protects the demonstrated failure mode.
  • A released owner contract is available for wrightkit/wright#228 to consume and its corresponding preprocessing integration regression passes without a Wright fallback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions