feat: add multiple integer types (i8, i16, i32, u8, u16, u32, u64)#113
Open
feat: add multiple integer types (i8, i16, i32, u8, u16, u32, u64)#113
Conversation
29bf08a to
1261de2
Compare
SpaceManiac
approved these changes
Feb 19, 2026
...rc/typecheck/snapshots/starstream_compiler__typecheck__tests__call_not_a_function_error.snap
Outdated
Show resolved
Hide resolved
57f02fe to
2300788
Compare
Add IntWidth enum with 8 variants and change Type::Int to Type::Int(IntWidth). Integer literals are now polymorphic — they get a fresh type variable constrained to integer types, with the concrete type determined by context and defaulting to i64. Cross-type arithmetic (e.g. i32 + i64) is a type error. Unsigned negation is rejected. Wasm codegen maps i64/u64 to ValType::I64 and all smaller types to ValType::I32 with appropriate truncation/sign-extension. Component ABI store functions are filled in for all widths. Overflow checking is generalized per type. Signed-off-by: rvcas <x@rvcas.dev>
Signed-off-by: rvcas <x@rvcas.dev>
2300788 to
67a6ea5
Compare
Signed-off-by: rvcas <x@rvcas.dev>
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
IntWidthenum with 8 variants (I8,I16,I32,I64,U8,U16,U32,U64) and changeType::InttoType::Int(IntWidth)i64when unconstrainedi32 + i64) is a type error; unsigned negation is rejectedValType::I64for 64-bit types andValType::I32for all smaller types with truncation/sign-extensionlet x: i8 = 300)E0044error page forLiteralOutOfRange