Skip to content

Ban bogus "existential types" #7084

Closed
@ilevkivskyi

Description

@ilevkivskyi

It is possible to get an unbound type variable in a variable type using a generic alias, for example:

from typing import TypeVar, Dict
  
T = TypeVar('T')
Alias = Dict[str, T]

x: Alias[T]
reveal_type(x)  # Revealed type is 'builtins.dict[builtins.str, T?]'

This doesn't makes sense currently and should give an error.

See also #6520 (this looks very similar but is actually a different issue specific to type aliases).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions