no error reported with the non-standard spreading a type var that is bound to a tuple
Description
def f[T: tuple[object, ...]]() -> tuple[*T]: ... # no error reported
there is no error reported here for this runtime crash. but we should still allow it when the annotation isn't evaluated because it's understandable to humans and type checkers
what error do you expect? this is just unpacking a tuple type into another tuple type right? it's redundant but i don't see how it should be an error
what error do you expect? this is just unpacking a tuple type into another tuple type right? it's redundant but i don't see how it should be an error
he doesn't know
try running it
File "/home/me/projects/test/asdf.py", line 1
def f[T: tuple[object, ...]() -> tuple[*T]: ... # no error reported
^
SyntaxError: expected '('
hmm, i think its because your code contains a syntax error?
hmm, i think its because your code contains a syntax error?
hmm, must have been a pebcak or AI slop or something like that
so this is the crash you're talking about:
Traceback (most recent call last):
File "/home/me/projects/test/asdf.py", line 1, in <module>
def f[T: tuple[object, ...]]() -> tuple[*T]: ... # no error reported
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/me/projects/test/asdf.py", line 1, in <generic parameters of f>
def f[T: tuple[object, ...]]() -> tuple[*T]: ... # no error reported
^^
TypeError: Value after * must be an iterable, not typing.TypeVar