Skip to content

Forward reference to a type alias results in an "Invalid type ..." error #2241

Closed
@jstasiak

Description

@jstasiak

mypy 0.4.5 and 0.4.4, CPython 3.5.1 and 3.5.2.

Code:

# code.py
def f(p: 'Alias') -> None:
    print(p)

Alias = int

Expected result:

% mypy code.py
%

Actual result:

% mypy code.py
code.py: note: In function "f":
code.py:1: error: Invalid type "code.Alias"
%

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions