Commit d94da1c2

d94da1c2e47aMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified

Description

Wire poly equality, nil?, and poly_array methods

poly/poly_array == and != (sp_poly_eq / sp_PolyArray_eq, boxing the non-poly side), poly.nil? (sp_poly_nil_p), and poly_array []/length/ push/<</first/include?/dup/compact/join/inspect via sp_PolyArray_* (elements boxed/unboxed at the boundary). dup/clone/compact/append now infer the receiver array type.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

Details

Commit
d94da1c2e47a
Parent
3bb483bdafdc

src/analyze.cmodifiedView file

@@ -148,9 +148,10 @@
148148 if (!strcmp(name, "join")) return TY_STRING;
149149 if (!strcmp(name, "inspect") || !strcmp(name, "to_s")) return TY_STRING;
150150 if (!strcmp(name, "empty?") || !strcmp(name, "include?")) return TY_BOOL;
151- if (!strcmp(name, "push") || !strcmp(name, "<<") ||
152- !strcmp(name, "reverse") || !strcmp(name, "sort") ||
153- !strcmp(name, "uniq") || !strcmp(name, "to_a")) return rt;
151+ if (!strcmp(name, "push") || !strcmp(name, "<<") || !strcmp(name, "append") ||
152+ !strcmp(name, "reverse") || !strcmp(name, "sort") || !strcmp(name, "uniq") ||
153+ !strcmp(name, "to_a") || !strcmp(name, "dup") || !strcmp(name, "clone") ||
154+ !strcmp(name, "compact")) return rt;
154155 if (!strcmp(name, "[]=")) return ty_array_elem(rt);
155156 }
156157