Skip to content

Better diagnostic for use of unbound ParamSpec #3197

@second-ed

Description

@second-ed

Summary

ty not identifying when the first arg of a Callable is ParamSpec when within a bound TypeVar

The first argument to Callable must be either a list of types, ParamSpec, Concatenate, or ...

Playground

main.py

from collections.abc import Callable
from typing import ParamSpec, TypeVar

P = ParamSpec("P")
C = TypeVar("C", bound=Callable[P, object])

causes ty to complain:

The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...` (invalid-type-form)

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    diagnosticsRelated to reporting of diagnostics.

    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