feat: integer width support (u8-u248, i8-i248)#70
Merged
brockelmore merged 1 commit intomainfrom Mar 11, 2026
Merged
Conversation
…c and type safety Add sub-256-bit integer types with full checked arithmetic, compile-time overflow detection, mixed-width/signedness rejection, unsuffixed literal type adoption, type casting, and signed opcode selection. - Literal type suffixes (42u8, 0xffi16) through lexer→parser→AST→IR - Cast syntax (expr as u8) with mask/sign-extend - Width-checked add/sub/mul that reverts on overflow for sub-256-bit types - Compile-time constant overflow detection with span-preserving diagnostics - Post-egglog overflow detection for optimization-revealed cases - Narrow-type-preserving egglog constant folding rules - Mixed-width rejection (u8 + u256 → error suggesting explicit cast) - Signed/unsigned mismatch rejection (i8 + u8 → error) - Unsuffixed literals adopt the type of the other operand - Signed opcodes (SDIV, SMOD, SLT, SGT, SAR) for IntT types - Sign-extend for signed type truncation - Paren expression type inference in infer_expr_type - 72 new e2e tests (35 unsigned, 37 signed) covering checked arithmetic, overflow reverts, boundary cases, unsafe wrapping, casts, comparisons, negation, compile-time error messages, and mixed-width rejection Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for edgelang ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No gas changes detected. |
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.
Summary
u8-u248,i8-i248) with full checked arithmetic, compile-time overflow detection, and type safety42u8,0xffi16), cast syntax (expr as u8), signed opcode selection (SDIV, SMOD, SLT, SGT, SAR)Test plan
cargo +nightly fmtcleanjust check-clippy-ciclean🤖 Generated with Claude Code