Commit 554a4eb7

554a4eb79996Merged

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

Description

fix(analyze,codegen): blk_param_types serialise as SA, not STR (#750)

@meth_blk_param_types is an array where each element can itself contain | (a multi-yield method serialises its per-position types as int|int). Previously the array was joined with | into a single STR record then ir_escape'd whole -- on read, val.split("|") collapsed all yields into one flat string.

Trigger: two methods, one yields 1, 2 (block sig mrb_int, mrb_int), one yields "a" (sig const char *). The flat read picked up foo's signature for bar, generating a C warning + wrong-type call at the second yield site.

Switch to SA (string array) so each element goes through ir_join_strs (per-element ir_escape) and ir_split_strs_n on read. Inner | survives the round-trip as %7C.

Closes #750

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

Details

Commit
554a4eb79996
Parent
80bc72064363

spinel_analyze.rbmodifiedView file

@@ -28624,8 +28624,11 @@
2862428624 # Non-array string ivars (computed in analyze, consumed by emit)
2862528625 buf = buf + "STR @cls_cmeth_live " + ir_escape(@cls_cmeth_live) + "\n"
2862628626 buf = buf + "STR @cls_meth_live " + ir_escape(@cls_meth_live) + "\n"
28627- buf = buf + "STR @meth_blk_param_types " + ir_escape(@meth_blk_param_types.join("|")) + "\n"
28628- buf = buf + "STR @cls_cmeth_blk_param_types " + ir_escape(@cls_cmeth_blk_param_types.join("|")) + "\n"
28627+ # Issue #750: switch to SA (string array) so each element is
28628+ # escaped individually -- inner `|` in `int|int` no longer
28629+ # collides with the outer separator on round-trip.
28630+ buf = ir_emit_sa(buf, "@meth_blk_param_types", @meth_blk_param_types)
28631+ buf = ir_emit_sa(buf, "@cls_cmeth_blk_param_types", @cls_cmeth_blk_param_types)
2862928632
2863028633 # Per-AST-node records (T / NM / NB / SN / ST) get accumulated
2863128634 # into a StrArray and joined once. Building them with `buf + ...`