Implement lexer int128 support#11571
Conversation
|
On Windows, the conversion from hex to dec fails, because the conversion is now handled using The default error message when |
|
I could also fall back to u64 on Windows and show that windows doesn't support u128 integers yet, but I think it's better to wait until it's supported everywhere. |
|
Does this need to be changed to include U/Int128? (I don't really know much about codegen) crystal/src/compiler/crystal/codegen/types.cr Line 199 in a9ee750 EDIT: Oh, it's the integers coming from the mathinterpreter, which doesn't yet support int128. |
|
I think it's not fully obvious what type should be deduced for literals that don't have an explicit suffix. |
|
The newest commit allows constant math expressions to be interpreted at compile-time. call void @"~A:init"(), !dbg !24
%57 = load i128, i128* @A, !dbg !24
call void @"*puts<Int128>:Nil"(i128 %57), !dbg !91
ret void, !dbg !91After: call void @"*puts<Int128>:Nil"(i128 3), !dbg !97
ret void, !dbg !97Code: A = 1_i128 + 2_i128
puts AI hope the CI won't fail (except for windows) |
|
Please move 128-bit math interpreter to a separate PR. It's unrelated to lexer support. And it needs specs. |
|
The MathInterpreter changes (and a few more things) have been extracted to #11576 |
|
In terms of functionality, this is rock-solid. I just tested a huge range of numbers and it all matches expectations as per #8373 (comment) Alternative 4 See all 4004 passing specs' names oprypin@3bb8a1a#diff-40baf545fe5167c85593fa7b286af7017cd0140411b0c12def7c995523d74b31R476 I codified all the number ranges in a shape that directly mirrors the tables from that comment. crystal/spec/compiler/lexer/lexer_spec.cr Lines 477 to 503 in 3bb8a1a |
|
#11551 has been merged. |
|
All specs pass with #11551 🎉 |
Supersedes #11196
Related to #8373
Closes #7915
Related to #5545
This PR implements int128 support in the lexer.