Commit ba7b1dfb

ba7b1dfb5efcMerged

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

Description

fix(rbs_extract,analyze): @ivar declarations in RBS seed + nullable push widen

The RBS extractor walked attr_accessor / attr_reader / attr_writer members but skipped the standalone @notice: String? instance- variable form. ActionDispatch::Flash declares its slots this way (not via attr_accessor in the RBS), so spinel inferred @notice as poly via cross-class fanout and downstream Flash#values returned a sp_PolyArray * into a declared sp_StrArray * return slot.

  • spinel_rbs_extract.c: handle RBS_AST_MEMBERS_INSTANCE_VARIABLE, emit the same ivar <name> <type> line shape as attr_accessor. seed_class_ivar tolerates either @name or name so no extra normalization needed.
  • analyze: scan_locals push handler recognised string but not string? / mutable_str for the int_array -> str_array promotion. Extend the arg-type match so arr.push(@nullable_str) widens the empty literal's array type to str_array instead of leaving it at int_array (which then errored at push site).

#685's roundhouse emit drops from 6 -> 5 warnings (the Flash#values shape gone). The 3 remaining sp_String * return warnings, the sp_StrPolyHash * vs sp_StrStrHash * return mismatch, and the button_to render_attrs cast are independent shapes.

Tests: default 460/0/0, promote 460/0/0, optcarrot checksum 59662.

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

Details

Commit
ba7b1dfb5efc
Parent
8b774e72730a

spinel_analyze.rbmodifiedView file

@@ -25562,7 +25562,7 @@
2556225562 end
2556325563 ki = ki + 1
2556425564 end
25565- elsif arg_type == "string"
25565+ elsif arg_type == "string" || arg_type == "string?" || arg_type == "mutable_str"
2556625566 @needs_str_array = 1
2556725567 ki = 0
2556825568 while ki < names.length