Skip to content

fix(opy): complete project preprocessing state - #154

Merged
Teakowa merged 4 commits into
mainfrom
codex/issue-142-preprocessing
Sep 1, 2026
Merged

fix(opy): complete project preprocessing state#154
Teakowa merged 4 commits into
mainfrom
codex/issue-142-preprocessing

Conversation

@e54-bot

@e54-bot e54-bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • extract settings blocks from included sources while preserving file provenance and lexer positions;
  • suppress repeated include imports while retaining directive records, and accept zero-argument function-like defines;
  • update issue-142 tests, support documentation, and full-corpus evidence.

Validation

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

The 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

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 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 (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 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/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

@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

Resolve preprocessing, settings, and compatibility expectation conflicts while preserving reference-visible duplicate include warnings.
@Teakowa
Teakowa merged commit 7e79ca0 into main Sep 1, 2026
5 checks passed
@Teakowa
Teakowa deleted the codex/issue-142-preprocessing branch September 1, 2026 11:09
@e54-bot e54-bot mentioned this pull request Sep 1, 2026
@e54-bot e54-bot mentioned this pull request Sep 2, 2026
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.

2 participants