GenericUnionsRecord<T, U>: !record
fields:
a: !union
tv: T*
t: T
b: !union
tm: T->U
t: T
yardl v0.4.0 generates invalid constructor code for both inner unions:
class GenericUnionsRecord(typing.Generic[T, T_NP, U]):
...
def __init__(self, *, ...):
self.a = a if a is not None else TvOrT.Tv([]())
self.b = b if b is not None else TmOrT.Tm({}())
Warnings on import (these are TypeErrors at runtime):
/workspaces/yardl/joe/issue-#112/python/odd/types.py:58: SyntaxWarning: 'list' object is not callable; perhaps you missed a comma?
self.a = a if a is not None else TvOrT.Tv([]())
/workspaces/yardl/joe/issue-#112/python/odd/types.py:59: SyntaxWarning: 'dict' object is not callable; perhaps you missed a comma?
self.b = b if b is not None else TmOrT.Tm({}())
This issue occurs when the first type in the union resolves to a Python list or dict.
Given the following model:
yardl v0.4.0 generates invalid constructor code for both inner unions:
Warnings on import (these are TypeErrors at runtime):
This issue occurs when the first type in the union resolves to a Python
list
ordict
.