Summary
Code for reproduction:
import typing
a: typing.Hashable = "GOOD"
a: typing.Sequence[typing.Hashable] = ["GOOD"]
a: typing.Hashable | typing.Sequence[typing.Hashable] = "GOOD"
a: typing.Hashable | typing.Sequence[typing.Hashable] = ["FAILS"]
With ty==0.0.1a19 it passes but with ty==0.0.1a20 the last line fails:
error[invalid-assignment]: Object of type `list[@Todo]` is not assignable to `Hashable`
--> x.py:6:1
|
4 | a: typing.Sequence[typing.Hashable] = ["GOOD"]
5 | a: typing.Hashable | typing.Sequence[typing.Hashable] = "GOOD"
6 | a: typing.Hashable | typing.Sequence[typing.Hashable] = ["FAILS"]
| ^
|
info: rule `invalid-assignment` is enabled by default
If I change Hashable to str or Sequence to list then it works. But typing.Hashable | typing.Sequence[typing.Hashable] is a common type in Pandas. E.g. https://github.com/pandas-dev/pandas/blob/3c14b71c8f965ff316b22dfb3d87839361f55297/pandas/core/frame.py#L6319 I'm not sure how to call those methods with ty==0.0.1a20 if I want to pass in a list of strings.
Version
0.0.1a20