Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pytype/tests/test_typevar1.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@ class A(Generic[T, S]):
""",
)

@test_utils.skipBeforePy((3, 12), "PEP 695 - 3.12 feature")
def test_unused_typevar_pep695_type_var_tuple(self):
errors = self.CheckWithErrors("""
type Tup[*Ts] = ( # not-supported-yet[e1]
tuple[int, *Ts] ) # invalid-annotation[e2]
""")
self.assertErrorRegexes(
errors,
{
"e1": "Using TypeVarTuple in Generics is not supported yet",
"e2": "Invalid type annotation '<instance of tuple>' \nNot a type",
},
)

@test_utils.skipBeforePy((3, 12), "PEP 695 - 3.12 feature")
def test_unused_typevar_pep695_class_both_generic_and_base(self):
errors = self.CheckWithErrors("""
Expand Down
8 changes: 7 additions & 1 deletion pytype/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3917,7 +3917,13 @@ def byte_INTRINSIC_PARAMSPEC(self, state):
return state

def byte_INTRINSIC_TYPEVARTUPLE(self, state):
# TODO: b/350910471 - Implement to support PEP 695
# We don't even support importing typing.TypeVarTuple so do the minimal to
# consume all the parameters, put any on the stack and move on.
self.ctx.errorlog.not_supported_yet(
self.frames, "Using TypeVarTuple in Generics is"
)
state, _ = state.pop()
state = state.push(self.ctx.convert.unsolvable.to_variable(state.node))
return state

def byte_INTRINSIC_SUBSCRIPT_GENERIC(self, state):
Expand Down
Loading