Skip to content

Prevent Windows debug stack overflows#11

Merged
loreste merged 1 commit into
loreste:mainfrom
attahn:fix/windows-debug-stack-overflow
Jul 21, 2026
Merged

Prevent Windows debug stack overflows#11
loreste merged 1 commit into
loreste:mainfrom
attahn:fix/windows-debug-stack-overflow

Conversation

@attahn

@attahn attahn commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Splits the large recursive type-checking and code-generation dispatchers into bounded handlers, preventing stack overflows on Windows debug builds without changing behavior.

Adds a regression covering 32 nested builtin calls and a 20-call method chain. The previous debug compiler overflows on this fixture; the refactored compiler passes it. Comments preserve the reason for the deliberately split dispatch structure.

Verified with cargo test --bin mako (78 passed) and the focused Mako regression test.

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of debug builds on Windows by preventing stack overflows when processing deeply nested expressions and chained calls.
    • Preserved stable behavior for complex arithmetic, nested error handling, and method-call expressions.
  • Build Improvements

    • Development builds now use settings that keep deep type checking and code generation within the default Windows stack limit.
  • Tests

    • Added coverage for deeply nested expressions and chained method calls to help prevent regressions.

@attahn

attahn commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai[bot] review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The type checker is refactored into dedicated expression and builtin-call helpers. Development profile settings, a deep expression-stack example, Windows CI coverage, and an unreleased changelog entry are added.

Changes

Type-checking and stack validation

Layer / File(s) Summary
Builtin call dispatch
src/types/mod.rs
Builtin matching is centralized and builtin typing is distributed across five helper groups while call-site safety, deprecation, task, and generic checks remain in check_call_expr.
Expression typing helpers
src/types/mod.rs
Typing for expression variants is extracted into dedicated helpers, including identifiers, operators, literals, conversions, control flow, indexing, fields, methods, and concurrency expressions.
Expression dispatcher wiring
src/types/mod.rs
check_expr routes expression variants to the extracted helpers and retains inline string interpolation handling.
Windows debug stack validation
Cargo.toml, examples/testing/deep_expr_stack_test.mko, .github/workflows/ci.yml, CHANGELOG.md
Development optimization is set to level zero, deep nested expressions and chained method calls are tested, Windows CI runs the test, and the build change is documented.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: loreste

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: preventing Windows debug stack overflows in debug builds.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

@attahn: I’ll review the changes, with particular attention to preserving dispatch behavior and the regression coverage for deeply nested calls.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@loreste
loreste marked this pull request as ready for review July 21, 2026 12:37
@loreste
loreste merged commit 01fda69 into loreste:main Jul 21, 2026
12 checks passed
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