Commit d0b372bf
d0b372bfdb38Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
Merge pull request #1330 from OriPekelman/fix/forward-ref-setter-overwiden
analyze: don't let a guessed (int-receiver) dispatch collapse a concrete setter param to poly
Details
- Commit
- d0b372bfdb38
- Parent
- efe9e83dcc1e
- Merge parent
- 1ad97ddd695a
spinel_analyze.rbmodifiedView file
@@ -16327,7 +16327,22 @@
1632716327
while kk_fwd_c < arg_count_fwd1632816328
at_fwd_c = infer_type(arg_ids_fwd[kk_fwd_c])1632916329
if kk_fwd_c < ptypes_fwd_c.length16330-
ptypes_fwd_c[kk_fwd_c] = unify_call_types(ptypes_fwd_c[kk_fwd_c], at_fwd_c, arg_ids_fwd[kk_fwd_c])16330+
prev_fwd_c = ptypes_fwd_c[kk_fwd_c]16331+
unified_fwd_c = unify_call_types(prev_fwd_c, at_fwd_c, arg_ids_fwd[kk_fwd_c])16332+
# The receiver type is unresolved ("int"), so this dispatch16333+
# target is a GUESS -- every user class defining mname at this16334+
# arity is walked, not just the real receiver's class. Lifting an16335+
# int-default param to a concrete type is the intended16336+
# fallback-signature fix; but letting a guessed target COLLAPSE an16337+
# already-concrete param to "poly" contaminates unrelated16338+
# same-named setters program-wide (a String-only `Row#body=`16339+
# widened to poly because an unrelated `Response#body=` site passes16340+
# a poly value through the same as-yet-int-typed local). The real16341+
# target's obj-/poly-receiver branches above still unify precisely16342+
# once the receiver type resolves. spinel-dev#8.16343+
if prev_fwd_c == "int" || unified_fwd_c != "poly"16344+
ptypes_fwd_c[kk_fwd_c] = unified_fwd_c16345+
end1633116346
end1633216347
kk_fwd_c = kk_fwd_c + 11633316348
end