fix(opy): complete project preprocessing state - #154
Conversation
Implement included settings extraction with source provenance, suppress duplicate imports while retaining directive records, and accept zero-argument function-like defines. Refresh corpus evidence and support documentation for the new project behavior. Refs #142
Teakowa
left a comment
There was a problem hiding this comment.
Major — crates/opy-rs/src/preprocess.rs (imported_files)
Duplicate suppression is keyed by the canonicalized identity. Pinned OverPy 9.7.10 keys imported files by the resolved path string, so aliases such as shared.opy and dir/../shared.opy are distinct imports upstream but collapse here. That can drop the second import's declarations/rules and violates #142's include semantics. Use the reference-visible resolved path identity for duplicate suppression; keep canonical identity separately for cycle detection if needed, and cover an alias-path case.
Major — crates/opy-rs/src/preprocess.rs (duplicate-import early return)
Pinned OverPy emits w_already_imported when a duplicate is suppressed, and the pinned OW1 Emulator oracle records that diagnostic. This implementation silently returns after recording the directive, so the newly declared source-supported behavior loses an observable preprocessing diagnostic. Preserve the duplicate-import warning through the frontend diagnostic contract.
Use reference-visible include paths for duplicate suppression and preserve w_already_imported as a source-attributed frontend warning through tooling and compile reports. Refs #142
Teakowa
left a comment
There was a problem hiding this comment.
Major — crates/opy-rs/src/compiler/mod.rs (compile_source_report_with_locale)
When frontend succeeds with w_already_imported but lowering/integration later fails, the Err(error) branch replaces frontend_diagnostics with only the integration error. The duplicate-import warning is therefore still lost from compile reports on this valid path. Preserve frontend_diagnostics and append the integration diagnostic before returning the failure report.
Keep preprocessing warnings when compile reports append lowering or integration diagnostics, and cover the mixed warning/error case. Refs #142
Resolve preprocessing, settings, and compatibility expectation conflicts while preserving reference-visible duplicate include warnings.
Summary
Validation
cargo fmt --all -- --checkcargo test --locked --workspace --all-targets --all-featurescargo clippy --locked --workspace --all-targets --all-features -- -D warningspython3 -m unittest discover -s compatibility/testspython3 compatibility/run_native.py --binary target/debug/opy-cli --semantic-binary target/debug/opy-compatThe full 63-fixture corpus has no regressions. The affected real-world projects now advance past the #142 project/preprocessing boundaries; remaining failures are later parser or external generator-script boundaries.
Refs #142