Skip to content

Commit

Permalink
Merge branch 'master' into TypeVar-02-basic-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed May 29, 2023
2 parents 0ea018e + a568f3a commit 8622a58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,8 @@ class TypeVarLikeExpr(SymbolNode, Expression):
# Upper bound: only subtypes of upper_bound are valid as values. By default
# this is 'object', meaning no restriction.
upper_bound: mypy.types.Type
# Default: used to resolve the TypeVar if the default is not explicitly given.
# By default this is 'AnyType(TypeOfAny.from_omitted_generics)'. See PEP 696.
default: mypy.types.Type
# Variance of the type variable. Invariant is the default.
# TypeVar(..., covariant=True) defines a covariant type variable.
Expand Down
4 changes: 4 additions & 0 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4283,6 +4283,8 @@ def process_paramspec_declaration(self, s: AssignmentStmt) -> bool:
s,
)

default: Type = AnyType(TypeOfAny.from_omitted_generics)

# PEP 612 reserves the right to define bound, covariant and contravariant arguments to
# ParamSpec in a later PEP. If and when that happens, we should do something
# on the lines of process_typevar_parameters
Expand Down Expand Up @@ -4347,6 +4349,8 @@ def process_typevartuple_declaration(self, s: AssignmentStmt) -> bool:
s,
)

default: Type = AnyType(TypeOfAny.from_omitted_generics)

if not self.incomplete_feature_enabled(TYPE_VAR_TUPLE, s):
return False

Expand Down

0 comments on commit 8622a58

Please sign in to comment.