Skip to content

Issue with specialization of aliases #444

@CraftSpider

Description

@CraftSpider

The following example results in the bug AttributeError: 'UnionType' object has no attribute 'name' when run through pytd. This is from most recent pytype from pip

from typing import Union, IO, AnyStr
from typing_extensions import Literal

_Data = Union[IO[AnyStr]]

def func(param: _Data[str]) -> None: ...

This is a minimal case that doesn't use the TypeVar nature of _Data, but for example it could be declared as (param: _Data[AnyStr]) -> AnyStr, which at the very least shouldn't error, even if the types aren't fully inferred.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions