Commit 677bf710
677bf7109d2fMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 3 files · +2 added · ~1 modified
Description
Merge pull request #1019 from neidiom/fix/hash-invert-return-type
analyze: fix Hash#invert return type in infer_method_name_type fallback
Details
- Commit
- 677bf7109d2f
- Parent
- 1258b57df6cc
- Merge parent
- a65b55468b08
spinel_analyze.rbmodifiedView file
@@ -5321,7 +5321,16 @@
53215321
return "int_array"53225322
end53235323
if mname == "invert"5324-
return "str_str_hash"5324+
# Hash#invert -- fallback; normally handled in infer_operator_type.5325+
if recv >= 05326+
rt_inv = infer_type(recv)5327+
if rt_inv == "str_str_hash" || rt_inv == "int_str_hash"5328+
return "str_str_hash"5329+
end5330+
if is_hash_type(rt_inv) == 15331+
return "poly_poly_hash"5332+
end5333+
end53255334
end53265335
if mname == "push" || mname == "append"53275336
if recv >= 0test/hash_invert.rbaddedView file
Loading diff…
test/hash_invert.rb.expectedaddedView file
Loading diff…