Commit 2d3b6b81
2d3b6b81ebedMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified
Description
Typed ivar hash promotion guard, poly ivar arithmetic, always-nil ivar guards
Three fixes surfaced by bundle_class_12:
- The empty-container promotion's
[]-read path now checks an ivar receiver's current type (as it already did for locals): a typed str_str_hash ivar must not be re-promoted toward str_poly, which widened the slot to poly and broke Hash#delete dispatch. @ivar OP= non a poly slot with a numeric operator falls back to runtime poly arithmetic (sp_poly_add/sub/mul/div with a boxed rhs) instead of emitting an invalid raw C compound assignment on sp_RbVal.if @modewhere every program-wide write to @mode is nil is statically false; emit_if drops the dead branch (whose body may contain calls that cannot type, e.g. sub with a nil replacement).
Fixes bundle_class_12.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- 2d3b6b81ebed
- Parent
- 9ba5a4205e9c
src/analyze.cmodifiedView file
@@ -5065,7 +5065,10 @@
50655065
if (lv2) rslot = lv2->type;50665066
}50675067
else if (rrty && !strcmp(rrty, "InstanceVariableReadNode")) {5068-
/* handled via slot below if it's TY_UNKNOWN */5068+
/* an already-typed ivar hash must not be re-promoted: unifying e.g.5069+
a str_str_hash with the promotion's str_poly target would widen the5070+
slot to poly. Only an untyped (empty-{}) ivar promotes here. */5071+
rslot = infer_type(c, recv);50695072
}50705073
if (rslot != TY_UNKNOWN) continue; /* already typed, skip */50715074
/* Only promote via [] read if the receiver local has at least onesrc/codegen.cmodifiedView file
Loading diff…