Repository navigation
fix(ir): validate identities and literals with distinct boolean types - #213
Merged
Merged
Conversation
Signed-off-by: LunaStev <luna@lunastev.org>
Signed-off-by: LunaStev <luna@lunastev.org>
This was referenced Sep 23, 2026
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.
Malformed modules can currently pass verification with duplicate IDs, inconsistent type metadata, or constants outside their declared type. AST lowering also accepts duplicate function/parameter names, silently wraps oversized integer literals, and discards expressions returned from void functions. This change rejects those inputs and separates boolean values from one-bit integers.
IR behavior
Type::Bool/boolrepresentation.Type::I1is a signed one-bit integer (-1 or 0), andType::U1is an unsigned one-bit integer (0 or 1). Ordinary integer literals with value 1 remain supported in their respective ranges.boolfrom comparisons and use it in checked-arithmetic result tuples. Branch, select, and trap conditions require bool; integers are not implicitly converted.Compatibility: callers previously using
Type::I1for booleans must migrate toType::Bool. Printed boolean types change fromi1tobool; the frontend JSONBoolrepresentation is unchanged.Repository changes
Refresh README with accurate capability descriptions, standalone assembly/IR examples, contributor links, and sponsorship information. Remove the three tracked
docs/files and ignore/docs/as requested; local documentation remains on disk and the new local design notes are not included in this PR.IR changes and the README/document-tracking changes are separate signed-off commits.
Validation
Executed locally on Linux with Rust/Cargo 1.96.0:
cargo test --workspace --locked --offline: 56 passed.cargo test --workspace --all-features --locked --offline: 70 passed.cargo test -p ir --all-features --release --locked --offline: 35 passed.cargo fmt --all -- --check, warning-free workspace rustdoc, andgit diff --check.New identity regressions failed against the original verifier before the fix. Regression coverage includes separate namespaces, bool/i1/u1 distinctions, scalar constant boundaries, explicit global alignment, malformed metadata, parameter bindings, void returns, and retaining runtime
1 + 2as constants plus an add instruction in O0 IR.SSA dominance/phi validation, complete instruction type verification, pointer safety, target ABI layout, and the broader arithmetic/optimization contracts remain separate work. This PR does not claim complete UB-free execution or a finished O0 pipeline.
Fixes #46
Fixes #47
Fixes #48
Fixes #49
Fixes #140
Fixes #141
Fixes #144