Commit 120b8f23
120b8f237d16Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified
Description
fix(analyze): str_int_hash → str_str_hash merge in method bodies (#443)
Sibling to #437. The refine_method_body_locals merge had no rule to upgrade str_int_hash → str_str_hash when pass 2 correctly resolved the value as string. Pass 1 fell back to vt=int because the value's source local (e.g. `pb` from `pb = b.split("/")`) wasn't declared yet; promote_empty_hash_for("string", "int") returned str_int_hash. Pass 2 with pb declared as str_array resolved pb[i] as string and picked str_str_hash, but the merge dropped the upgrade.
Add the missing rule, symmetric to the int_str_hash → str_str_hash rule added in 57d9731 (#437 follow-up) and the refine_locals_multi_pass_full str_int_hash → str_str_hash rule at line 20142.
Closes #443
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- 120b8f237d16
- Parent
- d53dd0271e05
spinel_analyze.rbmodifiedView file
elsif ltypes[k] == "int_str_hash" && (ltypes2[j] == "str_str_hash" || ltypes2[j] == "sym_str_hash" || ltypes2[j] == "str_int_hash" || ltypes2[j] == "sym_int_hash") ltypes[k] = ltypes2[j] set_var_type(lnames[k], ltypes2[j]) # Symmetric: pass 1 saw `vt=int` because the value's source # local (e.g. `pb` from `pb = b.split("/")`) wasn't declared # yet, leaving the hash at str_int_hash. Pass 2 with `pb` # declared as str_array correctly resolves pb[i] as string and # picks str_str_hash. Mirrors the rule in # refine_locals_multi_pass_full at line 20142. elsif ltypes[k] == "str_int_hash" && ltypes2[j] == "str_str_hash" ltypes[k] = ltypes2[j] set_var_type(lnames[k], ltypes2[j]) end end k = k + 1test/hash_value_split_widen.rbaddedView file
Loading diff…
test/hash_value_split_widen.rb.expectedaddedView file
Loading diff…