Commit 4e530529

4e530529882eMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 4 files · ~4 modified

Description

Symbol-keyed hashes via SymPolyHash (sym keys, boxed values)

A hash literal with symbol keys infers to TY_SYM_POLY_HASH and maps to the runtime sp_SymPolyHash family. Values are boxed on literal construction and []=; [] / fetch return poly. Adds the type to the lattice (key=symbol, val=poly, cname SymPoly) and c_type_name.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

Details

Commit
4e530529882e
Parent
440f2775f6c3

src/analyze.cmodifiedView file

@@ -399,6 +399,8 @@
399399 kt = ty_unify(kt, infer_type(c, nt_ref(nt, els[k], "key")));
400400 vt = ty_unify(vt, infer_type(c, nt_ref(nt, els[k], "value")));
401401 }
402+ /* symbol keys -> SymPolyHash (boxed values), regardless of value type */
403+ if (kt == TY_SYMBOL) return TY_SYM_POLY_HASH;
402404 return ty_hash_of(kt, vt);
403405 }
404406 if (!strcmp(ty, "YieldNode")) {