Commit b7fb0698
b7fb0698b8a3Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
analyze: refresh an instance_eval/exec call's own type after rebinding self
The post-fixpoint pass re-infers an instance_eval/exec block body with the
receiver class bound (an_ie_class_id), but left the splice call node's own
cached type at the value computed before the rebind. A consumer reading that
type (e.g. truthiness of if cfg.instance_eval { @flag = 1 }) then used the
int-nullable form on a poly result. Re-infer the call node itself inside the
rebound scope. Fixes bundle_classd_04.
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- b7fb0698b8a3
- Parent
- 48c7ca50ab91
src/analyze.cmodifiedView file
@@ -2440,6 +2440,10 @@
24402440
int saved2 = an_ie_class_id;24412441
an_ie_class_id = ty_object_class(rt2);24422442
for (int k2 = 0; k2 < bn2; k2++) infer_type(c, bb2[k2]);2443+
/* refresh the splice call's own type from the now-rebound body so a2444+
consumer (e.g. truthiness) sees the poly result, not the stale type2445+
computed before an_ie_class_id was bound. */2446+
infer_type(c, id);24432447
an_ie_class_id = saved2;24442448
}24452449