Commit 442ee85e

442ee85e4e06Merged

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

Description

codegen: float ** pow(), Array#concat, fix hangs_548 expected

  • analyze/codegen: add float ** support using pow(). Float ** Int/Float now returns Float and emits pow() call instead of unsupported arithmetic. Fixes integer_pow_negative_exponent test.

  • codegen: Array#concat(a, b, ...) in-place mutation. Emits a snapshot of each arg's length before its push loop so self-concat (a.concat(a)) uses the pre-loop length. Fixes hangs_548 concat section.

  • test: fix hangs_548.rb.expected. The fourth output (puts foo) returns nil (the method-level rescue is dead code when retry terminates at i==7); expected file previously had wrong value 123.

Tests: 707 pass, 3 fail, 135 error (was 705/3/137)

Co-Authored-By: Claude Sonnet 4.6 [email protected]

Details

Commit
442ee85e4e06
Parent
3a748efd0df5

src/analyze.cmodifiedView file

@@ -938,8 +938,9 @@
938938 }
939939 else if (brt == TY_FLOAT) {
940940 if (!strcmp(name, "+") || !strcmp(name, "-") || !strcmp(name, "*") ||
941- !strcmp(name, "/") || !strcmp(name, "abs") || !strcmp(name, "floor") ||
942- !strcmp(name, "ceil") || !strcmp(name, "round") || !strcmp(name, "truncate"))
941+ !strcmp(name, "/") || !strcmp(name, "**") || !strcmp(name, "abs") ||
942+ !strcmp(name, "floor") || !strcmp(name, "ceil") || !strcmp(name, "round") ||
943+ !strcmp(name, "truncate"))
943944 return TY_FLOAT;
944945 if (!strcmp(name, "to_i")) return TY_INT;
945946 if (!strcmp(name, "to_s")) return TY_STRING;