Commit 24f08f66
24f08f66e281Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified
Description
Nullable floats via the NaN sentinel, and Array#pop
Float mirrors the nullable-int treatment: first/last of an empty float array already return the NaN sentinel (sp_float_nil), and the operators are now sentinel-aware -- Float#nil? -> sp_float_is_nil, and inspect / to_s / p / puts render nil via sp_float_opt_inspect / sp_float_opt_to_s.
Array#pop is added for typed arrays (the test empties an array before reading first/last); it returns the element type and mutates in place.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- 24f08f66e281
- Parent
- 6b9d39bc23e3
src/analyze.cmodifiedView file
@@ -466,7 +466,8 @@
466466
!strcmp(name, "count") || !strcmp(name, "index")) return TY_INT;467467
if (!strcmp(name, "sum")) return ty_array_elem(rt);468468
if (!strcmp(name, "first") || !strcmp(name, "last") ||469-
!strcmp(name, "min") || !strcmp(name, "max")) return ty_array_elem(rt);469+
!strcmp(name, "min") || !strcmp(name, "max") ||470+
!strcmp(name, "pop")) return ty_array_elem(rt);470471
if (!strcmp(name, "minmax")) return rt; /* [min, max], same element kind */471472
if (!strcmp(name, "join")) return TY_STRING;472473
if (!strcmp(name, "pack") && argc == 1) return TY_STRING;src/codegen.cmodifiedView file
Loading diff…