I decided to abandon the automatic union field selection idea and implemented an explicit form of assignment. The behavior implemented is:
If an union is assigned to an union, they need to be identical. This is handled by the general unstructured case.
If an union is assigned to a dict (or vice versa), the dict is required to be a singleton. The field named in the dict is assigned.
This should allow simple usage of unions in method calls and method return values.
Additional changes are:
All ValueCastables are treated strictly, not just Views. This enforces strictness in Enum assignment: if an Enum is assigned, it needs to be assigned from the same type of Enum.
Single-field structure exception is now applied recursively, for graceful handling of weird corner cases.
I decided to abandon the automatic union field selection idea and implemented an explicit form of assignment. The behavior implemented is:
This should allow simple usage of unions in method calls and method return values.
Additional changes are:
ValueCastable
s are treated strictly, not justView
s. This enforces strictness inEnum
assignment: if anEnum
is assigned, it needs to be assigned from the same type ofEnum
.