Skip to content

Commit

Permalink
Handle placeholder types better
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Feb 3, 2024
1 parent 9e24903 commit 2be354b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,14 +1639,15 @@ def analyze_class(self, defn: ClassDef) -> None:

for tvd in tvar_defs:
if isinstance(tvd, TypeVarType) and any(
has_placeholder(t) for t in [tvd.upper_bound, tvd.default] + tvd.values
has_placeholder(t) for t in [tvd.upper_bound] + tvd.values
):
# Some type variable bounds or values are not ready, we need
# to re-analyze this class.
self.defer()
if has_placeholder(tvd.default):
if isinstance(tvd, TypeVarLikeType) and has_placeholder(tvd.default):
# Placeholder values in TypeVarLikeTypes may get substituted in.
# Defer current target until they are ready.
self.defer()
self.mark_incomplete(defn.name, defn)
return

Expand Down

0 comments on commit 2be354b

Please sign in to comment.