Commit a4ed67a5

a4ed67a50fd9Merged

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

Description

case/when on a poly subject compares via sp_poly_eq

A case whose subject is a poly value (sp_RbVal) now matches each when clause with sp_poly_eq against the boxed condition, instead of a raw C == between an sp_RbVal and a scalar.

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

Details

Commit
a4ed67a50fd9
Parent
ee2689d5d693

src/codegen.cmodifiedView file

@@ -4087,6 +4087,9 @@
40874087 else if (pt == TY_STRING) {
40884088 buf_printf(b, "sp_str_eq(_t%d, ", t); emit_expr(c, conds[j], b); buf_puts(b, ")");
40894089 }
4090+ else if (pt == TY_POLY) {
4091+ buf_printf(b, "sp_poly_eq(_t%d, ", t); emit_boxed(c, conds[j], b); buf_puts(b, ")");
4092+ }
40904093 else {
40914094 buf_printf(b, "(_t%d == ", t); emit_expr(c, conds[j], b); buf_puts(b, ")");
40924095 }
@@ -4163,6 +4166,7 @@
41634166 buf_puts(b, "0");
41644167 }
41654168 else if (pt == TY_STRING) { buf_printf(b, "sp_str_eq(_t%d, ", t); emit_expr(c, conds[j], b); buf_puts(b, ")"); }
4169+ else if (pt == TY_POLY) { buf_printf(b, "sp_poly_eq(_t%d, ", t); emit_boxed(c, conds[j], b); buf_puts(b, ")"); }
41664170 else { buf_printf(b, "(_t%d == ", t); emit_expr(c, conds[j], b); buf_puts(b, ")"); }
41674171 }
41684172 else { buf_puts(b, "("); emit_expr(c, conds[j], b); buf_puts(b, ")"); }