P1-06: add typed MIR validation and scalar HIR lowering - #2
Merged
Merged
Conversation
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 free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
P1-06 needs an explicit typed control-flow representation between P1-04 type checking and the later ownership/backend passes. This PR adds immutable MIR, bounded structural/type/CFG validation, deterministic formatting with source spans and HIR IDs, and opt-in scalar HIR lowering through
SafeCoreMirLowering.Lower.Lowering covers scalar locals, assignments, direct calls, branches, loops, early returns, loop values and short-circuit operators. Temporary reads preserve evaluation order across side effects. Unsupported constructs produce explicit diagnostics and failed lowering publishes no partial program. Validation covers unreachable blocks and malformed IDs/types as well as ordinary control-flow edges.
This PR is stacked on #1; review and merge #1 first. P1-06 remains 🚧 In progress. Aggregate/reference/pattern/closure lowering, definite initialization, ownership and executable backend integration remain subsequent work. The source gate retains P1-04's rejection of control-flow labels. See
docs/typed-mir-profile.mdand the paired roadmaps for the precise contract.Validation: ✅ Release solution build with warnings treated as errors; ✅ 301/301 executable regression tests on the combined branch, including 12 MIR validation groups and 7 source-lowering groups with an independent bounded CFG interpreter; ✅ bilingual roadmap checks and
git diff --check. Local validation used installed .NET SDK 10.0.401; the repository's 10.0.400 SDK pin remains unchanged. This batch makes no new runtime/AOT or rustc differential conformance claim.