Commit bdbf7949

bdbf794902b0Merged

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

Description

codegen: unbox a poly arg to a scalar param in the poly-receiver method dispatch

The cls_id-switch dispatch for a method called on a poly receiver boxed a scalar arg into a poly param but had no reverse arm: a poly arg (e.g. the other operand of a user <=> whose operands are widened ivars) into a concrete scalar param was passed raw and failed to typecheck. Add the emit_unbox_text arm, mirroring the box arm. (The between?/clamp arg-hoist path these tests also hit is separate.)

Co-Authored-By: Claude Opus 4.8 [email protected]

Details

Commit
bdbf794902b0
Parent
de224e1797e8

src/codegen_call.cmodifiedView file

@@ -8311,6 +8311,7 @@
83118311 TyKind at = atmp_ty[a]; /* the temp's actual type (poly for a nil/void arg) */
83128312 char tn[32]; snprintf(tn, sizeof tn, "_t%d", atmp[a]);
83138313 if (pt == TY_POLY && at != TY_POLY) emit_boxed_text(c, at, tn, &cb);
8314+ else if (at == TY_POLY && pt != TY_POLY && pt != TY_UNKNOWN) emit_unbox_text(c, pt, tn, &cb);
83148315 else buf_puts(&cb, tn);
83158316 }
83168317 else {