The code for checking whether a type in serialization.py would fail if given _is_dataclass(Union), because Union has no __dict__. This change fixes it. Note that if you use a bare Union in a function type annotation, you still get the following:
TypeError: Invalid type annotation for argument 'x' of sematic.tests.test_function.f: typing.Union must be parametrized (typing.Union[...] instead of typing.Union).
The code for checking whether a type in
serialization.py
would fail if given_is_dataclass(Union)
, becauseUnion
has no__dict__
. This change fixes it. Note that if you use a bareUnion
in a function type annotation, you still get the following: