Some checks are pending
docs / build-and-deploy (push) Waiting to run
Add `long`, a 64-bit signed integer primitive (i64), threaded through codegen: llty; int<->long coercion (coerce_code/to_long) at let/assign/ return/call-args; i64 arithmetic + comparison promotion in emit_bin; unary negate/~; print via %lld and str()/interpolation via @fn_long_str. Editor vocabulary (syntax header, TextMate grammar, formatter, LSP) synced; check-vocabulary green. Numeric literals stay i32 — build large values by widening (documented on the type page). Complete the Hash.* namespace (issue #17) with both 32- and 64-bit algorithms: Hash.of/fnv1a/crc32/mix/combine (32-bit) and Hash.of64/fnv1a_64/mix64 (64-bit, returning long). Deterministic and C-free; CRC-32 (poly 0xEDB88320) and FNV vectors verified against reference implementations. Tests: selfhost/tests/{hash,long}.ludic. Docs: docs/language/hash/*, type-long.md. Seed reseeded; C-free bootstrap fixpoint holds; 23 selfhost + 45 regression + 29 tooling checks green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
23 lines
938 B
Text
23 lines
938 B
Text
program T {
|
|
fn wide(a: long, b: int) -> long { return a * b } # int arg widens to i64
|
|
|
|
entry {
|
|
let big: long = 1000000 # int literal widens to a long
|
|
let sq = big * big # i64 multiply -> 10^12, no overflow
|
|
print(sq) # 1000000000000
|
|
print(sq + 1) # 1000000000001
|
|
var acc: long = 0
|
|
acc += sq
|
|
acc += 5 # compound assign in i64
|
|
print(acc) # 1000000000005
|
|
print(wide(big, 3000000)) # 3000000000000 (> i32 max)
|
|
let x: long = big * 3
|
|
let y = big * 2 # inferred long
|
|
print(x > y) # 1
|
|
print(y < x) # 1
|
|
print(x == x) # 1
|
|
print(0 - sq) # -1000000000000 (unary negate stays 64-bit)
|
|
print(big) # 1000000
|
|
print(Text.length(str(sq))) # 13 — str(long) renders all 13 digits
|
|
}
|
|
}
|