Skip to content

feat(opy): complete preprocessing, macros, and project composition - #147

Merged
Teakowa merged 2 commits into
mainfrom
codex/issue-142-preprocessing
Aug 31, 2026
Merged

feat(opy): complete preprocessing, macros, and project composition#147
Teakowa merged 2 commits into
mainfrom
codex/issue-142-preprocessing

Conversation

@e54-bot

@e54-bot e54-bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • support #!defineMember object-like and function-like macros through the existing textual expansion and provenance path
  • resolve nested includes relative to the including source file while preserving file registry and source diagnostics
  • validate and record the remaining pinned backend-only preprocessing directives without approximating optimizer, localization, extension, output, or compression behavior
  • add public compile-path coverage and synchronize the support matrix and full-corpus expectations

Verification

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-targets --all-features
  • python3 -m unittest discover -s compatibility/tests
  • cargo build --locked -p opy-cli --bin opy-cli
  • cargo build --locked -p opy-cli --features compatibility --bin opy-compat
  • python3 compatibility/run_native.py --binary target/debug/opy-cli --semantic-binary target/debug/opy-compat

The full 61-fixture corpus reports compile-status: 61 match with no regression, unexpected divergence, or inconclusive result. The two real-world projects that remain failures now stop at their next owned boundaries: included settings placement in 6v6 Adjustments and lexer line continuation in ow1-emulator.

Closes #142

Support defineMember macros, including-file-relative composition, and the remaining pinned directive state while keeping backend-only effects explicit.

Fixes #142

@Teakowa Teakowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major — crates/opy-rs/src/preprocess.rs (#!defineMember handling / DefineRecord)

#!defineMember is routed through the normal define() path without preserving that it is a member macro. The pinned OverPy frontend records isMember and exposes these macros through the member-macro surface, so this loses an observable source-level distinction required by #142. Preserve member identity in preprocessing/HIR/tooling and cover that classification.

Major — crates/opy-rs/src/preprocess.rs (#!extension handling)

The new branch only validates that the argument is one word. Pinned OverPy rejects extension names outside the Workshop extension schema, so invalid #!extension values are now accepted while the support matrix claims the directive is validated. Validate the value against the canonical extension domain without copying Workshop-owned catalog semantics into opy-rs.

Major — crates/opy-rs/src/preprocess.rs::include

Nested includes now resolve relative to the including file, but the file registry still stores path: include.to_string(). For dir/child.opy including grandchild.opy, file id 2 points at grandchild.opy instead of the resolved dir/grandchild.opy, so diagnostics/provenance identify the wrong source path. Record the resolved display path and cover the nested registry path.

Preserve defineMember identity through HIR and tooling, validate extensions against the canonical schema, and record resolved nested include paths.

@Teakowa Teakowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Teakowa
Teakowa merged commit 01dabd9 into main Aug 31, 2026
5 checks passed
@Teakowa
Teakowa deleted the codex/issue-142-preprocessing branch August 31, 2026 15:12
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.

Complete OverPy preprocessing, macros, directives, and project composition

2 participants