Commit 1984631b
1984631b081fMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
Empty {} promotes to SymPolyHash on symbol-key []=; hash.each binds k/v
An empty hash filled via h[:sym] = v infers to TY_SYM_POLY_HASH; the generic hash.each codegen (order[]/get) already iterates it with k=symbol and v=poly block params.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- 1984631b081f
- Parent
- 4e530529882e
src/analyze.cmodifiedView file
@@ -943,6 +943,12 @@
943943
if (lv->type != TY_UNKNOWN && !ty_is_hash(lv->type)) continue;944944
lv->type = ty_unify(lv->type, hv);945945
}946+
else if (kt == TY_SYMBOL) {947+
/* symbol key -> SymPolyHash (boxed values) */948+
if (vt == TY_UNKNOWN) continue;949+
if (lv->type != TY_UNKNOWN && lv->type != TY_SYM_POLY_HASH) continue;950+
lv->type = TY_SYM_POLY_HASH;951+
}946952
}947953
948954
/* detect change vs the stashed old types */