Skip to content

Instantly share code, notes, and snippets.

@mrahtz

mrahtz/test.py Secret

Last active January 13, 2022 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrahtz/cc86c29538de1d4a80a2e8958ae71c5a to your computer and use it in GitHub Desktop.
Save mrahtz/cc86c29538de1d4a80a2e8958ae71c5a to your computer and use it in GitHub Desktop.
from typing import Any, Generic, TypeVar
from pyre_extensions import TypeVarTuple, Unpack
Ts = TypeVarTuple('Ts')
class C(Generic[Unpack[Ts]]):
pass
Ts1 = TypeVarTuple('Ts1')
Ts2 = TypeVarTuple('Ts2')
Foo = tuple[C[Unpack[Ts1]], C[Unpack[Ts2]]]
t: Foo[int, str]
reveal_type(t)
"""
ƛ Found 3 type errors!
test.py:13:3 Invalid type variable [34]: The type variable `Ts1` can only be used to annotate generic classes or functions.
test.py:13:3 Invalid type variable [34]: The type variable `Ts2` can only be used to annotate generic classes or functions.
test.py:14:0 Revealed type [-1]: Revealed type for `t` is `typing.Any`.
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment