You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 29, 2026. It is now read-only.
This is a large-scale structural refactoring (7031 additions / 6875 deletions) that splits monolithic files in crates/compiler/src/ into organized submodules. No functional logic is changed — the PR is purely about code organization and maintainability.
Separation of concerns is clean.resource_lint splitting into program.rs / state.rs / word.rs is a particularly good decomposition — those were previously three distinct responsibilities tangled in one file.
error_flag_lint split into analyzer.rs + state.rs is idiomatic and makes the state machine much easier to reason about in isolation.
Test extraction is consistent — every module now has a dedicated tests.rs, which makes it easy to find tests and reduces line count in the implementation files.
Re-exports are correct. The pub use declarations in parent modules (e.g., pub use helpers::{check_collisions, check_union_collisions, find_stdlib};) preserve the existing public API surface without breakage.
This is functionally correct — since lib.rs and main.rs are crate roots (not mod.rs files), Rust won't automatically look for submodules in lib/ or main/ directories. Using #[path] is the right solution here.
That said, it's worth leaving a brief comment explaining why the #[path] attribute is needed, since developers unfamiliar with this pattern may be confused:
// lib.rs — crate roots can't use automatic path resolution for subdirectories#[path = "lib/tests.rs"]mod tests;
Glob re-export in ast.rs
pubuse types::*;
This is a wide export. If types.rs grows, new types will silently become part of ast's public API. Consider explicit re-exports (pub use types::{SourceLocation, Type, ...}) to make the API surface intentional and searchable. This is a low-priority style preference — the current approach works fine.
No new tests added
This is expected for a pure refactoring, but it's worth calling out: the submodule boundaries create natural seams where integration tests between modules would add value in future PRs (e.g., testing that resolver → lint → resource_lint pipeline produces expected output for a known input).
This is pre-existing code, not introduced here. But now that StackState lives in its own file, it's more visible — worth considering whether StackState could implement a cheaper fork()/merge() API in a future pass rather than full cloning.
Correctness assessment
All pub use re-exports correctly expose the symbols previously accessible from the monolithic files.
use super::* in test files is appropriate and matches the previous inline test pattern.
The use super::state::{...} imports in resource_lint/program.rs and resource_lint/word.rs are explicit, which is better than glob-importing across module boundaries.
No unsafe code added.
No changes to public API signatures.
Summary
This is a clean, well-executed refactoring. The modular structure makes the codebase significantly easier to navigate and will make future typechecker phases easier to scope and review. No correctness issues found.
Suggested follow-ups (not blocking):
Add comments explaining the #[path] workaround on lib.rs / main.rs
Consider explicit re-exports in place of pub use types::* in ast.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.