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 PR fixes a critical bug where the REPL was not properly initializing the auxiliary stack slot counts needed for code generation. The fix aligns the REPL's code path with the main compiler by extracting and setting aux_max_depths from the typechecker.
Code Quality ✅
Positive:
The fix is minimal and follows the existing pattern used in crates/compiler/src/lib.rs:298-309 and lib.rs:432-435
Variable naming is consistent with the rest of the codebase (aux_max_depths)
The placement is correct - the depths are extracted after type checking and set before codegen
Follows the project's conventions for single-responsibility changes
No unnecessary abstractions or over-engineering
Clear and straightforward implementation
Correctness ✅
The implementation correctly:
Extracts aux_max_depths from the typechecker (line 262)
Sets them on the codegen instance before program compilation (line 264)
Maintains the same order of operations as the main compiler
Verification: The fix mirrors the working implementation in crates/compiler/src/lib.rs, ensuring consistency across compilation paths.
Test Coverage ⚠️
Missing test for REPL:
While the main compiler has unit tests for aux stack functionality (test_aux_max_depths_tracked in crates/compiler/src/typechecker.rs:4717), there's no specific test for the REPL path.
Recommendation: Consider adding a REPL-specific test to prevent regression. The new example file examples/language/aux-stack.seq provides excellent test cases that could be adapted for REPL testing. For example:
#[test]fntest_repl_aux_stack(){let source = ": test ( Int -- Int ) >aux aux> ;";let result = analyze_with_config(source,&CompilerConfig::default());assert!(result.errors.is_empty());assert!(result.llvm_ir.is_some());}
Documentation ✅
Excellent example file:
The new examples/language/aux-stack.seq is exceptionally well-documented:
Clear explanation of aux stack semantics (word-local, LIFO, must be empty on return)
Progressive examples from simple to complex
Demonstrates real-world use cases (formatting, pattern matching, multiple stashes)
Includes both "with aux" and "without aux" comparisons
Well-structured with clear section headers
This example serves as both documentation and educational material for the aux stack feature.
Performance ✅
No performance concerns:
take_aux_max_depths() is already called in the main compiler path
The operation is O(1) - just moving a HashMap from typechecker to codegen
No additional allocations or computational overhead
Security ✅
No security concerns identified. The aux stack feature is:
Compiler-enforced (must be empty on word return)
Type-safe
Word-local (no cross-word contamination)
Overall Assessment
Verdict: Approved ✅
This is a clean, focused bug fix that:
Solves a real issue (REPL couldn't compile aux stack code)
Follows established patterns
Includes excellent documentation via the example file
Has no security or performance concerns
Minor suggestion: Add a REPL-specific test case to prevent future regressions.
References
Related code: crates/compiler/src/lib.rs:298-309, lib.rs:432-435
Test coverage: crates/compiler/src/typechecker.rs:4717
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.