feat(opy): complete preprocessing, macros, and project composition - #147
Conversation
Support defineMember macros, including-file-relative composition, and the remaining pinned directive state while keeping backend-only effects explicit. Fixes #142
Teakowa
left a comment
There was a problem hiding this comment.
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.
Summary
#!defineMemberobject-like and function-like macros through the existing textual expansion and provenance pathVerification
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --all-targets --all-featurespython3 -m unittest discover -s compatibility/testscargo build --locked -p opy-cli --bin opy-clicargo build --locked -p opy-cli --features compatibility --bin opy-compatpython3 compatibility/run_native.py --binary target/debug/opy-cli --semantic-binary target/debug/opy-compatThe full 61-fixture corpus reports
compile-status: 61 matchwith 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