feat(lang): L4 type checker between parse and emit

selfhost/check/ walks every function, the entry, tests, globals' initializers and
@On listeners with real scopes, and refuses mixed number kinds, text and numbers,
two record types, mismatched slices and fn types, wrong argument counts, wrong
returns and wrong push elements - every mix-up at once, each at its line.
LUDIC_CHECK_REPORT=1 lists them by category. pointer stays untyped (L7's).

What it found is fixed: render3d's HDR scan calling the float-bits extern f_lt
with floats; ludic.shooter's right-stick aim overflowing past half a push;
prof.ludic storing longs in []int; extern arguments now coerced to their
parameters. Text-returning runtime functions say string; Assets.ready says bool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-24 01:34:49 +03:00
parent 0677aee93f
commit 57b66bdf47
52 changed files with 27005 additions and 11844 deletions

View file

@ -279,7 +279,7 @@ function bigint_to_int(a: BigNum) -> int {
}
# a limb (< 1e9) as exactly nine digits, left-padded with zeros
function bn_pad9(x: int) -> pointer {
function bn_pad9(x: int) -> string {
var s = string(x)
var pad = 9 - len(s)
var out = ""
@ -287,7 +287,7 @@ function bn_pad9(x: int) -> pointer {
return out + s
}
function bigint_str(a: BigNum) -> pointer {
function bigint_str(a: BigNum) -> string {
if a.sign == 0 { return "0" }
var out = ""
if a.sign < 0 { out = "-" }
@ -364,7 +364,7 @@ function decimal_rescale(d: Dec, places: int) -> Dec {
return dec_make(m, places)
}
function decimal_str(d: Dec) -> pointer {
function decimal_str(d: Dec) -> string {
var neg = ""
var m = d.m
if m.sign < 0 { neg = "-"; m = bigint_neg(m) }