2026.05.16.1¶
The mapping arm of the public
ValueInputtype (accepted byref_valuesandbound_refs) is now a covariant-key read-onlyValueItemsMapprotocol instead of an invariantMapping, so nesteddictliterals with any scalar key type (str,int, mixed, …) are accepted by type checkers without an explicit annotation. This is a type-only relaxation that accepts strictly more inputs; runtime behavior is unchanged.~literalizer.Scalagains the samerecord_shape_namesconstructor parameter, aMapping[frozenset[str], str]from a record shape’s key-set to a customcase classname. A mapped shape is declared and rendered with the given name instead of the auto-generatedRecordN; therecord_struct_name_prefixcounter advances only for the shapes with no custom name. Names are validated as PascalCase Scala identifiers that do not collide with the auto{prefix}{N}pattern or each other, raising~literalizer.exceptions.InvalidRecordNameError. Itssupports_record_shape_nameslanguage-class flag is nowTrue. See #2332.~literalizer.Pythongains an opt-inRECORDheterogeneous_strategy(already on~literalizer.Rust,~literalizer.Go,~literalizer.Kotlin,~literalizer.Scalaand~literalizer.Java). Each record-shaped dict (non-empty, string-keyed) becomes a generated frozen@dataclasses.dataclassdeclared in the preamble (with animport dataclasses) plus a matchingRecordN(field=value, ...)literal; field names are the dict keys verbatim and the class-name prefix is configurable via the newrecord_struct_name_prefixconstructor parameter. Python’sdictis already heterogeneous, so every record-shaped dict is representable as a plaindict; this is purely an idiomatic-output choice, the strategy is opt-in, and the default (ERROR) plain-dictoutput is unchanged. See #2419.~literalizer.Javagains the samerecord_shape_namesconstructor parameter (already on~literalizer.Rust,~literalizer.Goand~literalizer.Kotlin), aMapping[frozenset[str], str]from a record shape’s key-set to a customrecordname. A mapped shape is declared and rendered with the given name instead of the auto-generatedRecordN; therecord_struct_name_prefixcounter advances only for the shapes with no custom name. Names are validated as PascalCase Java identifiers that do not collide with the auto{prefix}{N}pattern, the wrapper class name (module_name), or each other, raising~literalizer.exceptions.InvalidRecordNameError. Itssupports_record_shape_nameslanguage-class flag is nowTrue. See #2333.