Commit fcf36ff3
fcf36ff3e435Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
Equality between two same-kind typed arrays
[a] == [b] for two int/str/float arrays now dispatches to the sp_*Array_eq element-wise comparators instead of falling through to the unsupported-equality error. Unblocks array results (e.g. push/append returning the array) compared against an array literal.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- fcf36ff3e435
- Parent
- 1a60cc65c07d
src/codegen.cmodifiedView file
@@ -1358,6 +1358,14 @@
13581358
buf_puts(b, eq ? ")" : "))");13591359
return;13601360
}1361+
/* two typed arrays of the same kind: element-wise compare */1362+
if (array_kind(rt) && rt == a0) {1363+
if (!eq) buf_puts(b, "(!");1364+
buf_printf(b, "sp_%sArray_eq(", array_kind(rt));1365+
emit_expr(c, recv, b); buf_puts(b, ", "); emit_expr(c, argv[0], b);1366+
buf_puts(b, eq ? ")" : "))");1367+
return;1368+
}13611369
/* poly array vs a typed array: box the typed side element-wise */13621370
if ((rt == TY_POLY_ARRAY && array_kind(a0)) || (a0 == TY_POLY_ARRAY && array_kind(rt))) {13631371
int polyn = rt == TY_POLY_ARRAY ? recv : argv[0];