Skip to content

typevars becoming types with typevars doesn't work #1236

Closed
@ddfisher

Description

@ddfisher
from typing import TypeVar
T = TypeVar('T')
V = TypeVar('V')

def identity(x: T) -> T: ...
def type_var_using_fn(x: V) -> None: ...
identity(type_var_using_fn)

has the confusing error:

test.py:10: error: Argument 1 to "identity" has incompatible type Callable[[V], None]; expected Callable[[V], None]

This is most commonly seen when decorating functions with TypeVars.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions