Closed as not planned
Description
It appears that Union types for Protocol attributes aren't recognized.
Repro example:
from typing import Type, Union
from typing_extensions import Protocol
class HasFoo(Protocol):
# foo: str # works
foo: Union[str, int] # fails
def dec(cls: Type[HasFoo]) -> Type[HasFoo]:
return cls
@dec
class Thing:
foo = 'abc'
Failing output:
Argument 1 to "dec" has incompatible type "Type[Thing]"; expected "Type[HasFoo]"
Misc info:
Tested with both mypy 0.630 and mypy master (e12be3b), run with --strict