Skip to content

Commit 4031bdd

Browse files
committed
1 parent 8b73cc2 commit 4031bdd

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

mypy/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ def set_strict_flags() -> None:
13591359
parser.error("Can only find occurrences of class members.")
13601360
if len(_find_occurrences) != 2:
13611361
parser.error("Can only find occurrences of non-nested class members.")
1362-
state.find_occurrences = _find_occurrences # type: ignore[assignment]
1362+
state.find_occurrences = _find_occurrences
13631363

13641364
# Set reports.
13651365
for flag, val in vars(special_opts).items():

mypy/subtypes.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,10 @@ def visit_instance(self, left: Instance) -> bool:
435435
# dynamic base classes correctly, see #5456.
436436
return not isinstance(self.right, NoneType)
437437
right = self.right
438-
if isinstance(right, TupleType) and right.partial_fallback.type.is_enum:
439-
return self._is_subtype(left, mypy.typeops.tuple_fallback(right))
438+
if isinstance(right, TupleType):
439+
return self._is_subtype(left, right.partial_fallback) and self._is_subtype(
440+
left, mypy.typeops.tuple_fallback(right)
441+
)
440442
if isinstance(right, Instance):
441443
if type_state.is_cached_subtype_check(self._subtype_kind, left, right):
442444
return True

test-data/unit/check-tuples.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ t1: Tuple[A, A]
113113
t2: tuple
114114

115115
if int():
116-
t1 = t2 # E: Incompatible types in assignment (expression has type "Tuple[Any, ...]", variable has type "Tuple[A, A]")
116+
t1 = t2
117117
if int():
118118
t2 = t1
119119

test-data/unit/check-typevar-tuple.test

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ f(empty) # E: Argument 1 to "f" has incompatible type "Tuple[()]"; expected "Tu
6161
f(bad_args) # E: Argument 1 to "f" has incompatible type "Tuple[str, str]"; expected "Tuple[int, str]"
6262

6363
# The reason for error in subtle: actual can be empty, formal cannot.
64-
reveal_type(f(var_len_tuple)) # N: Revealed type is "Tuple[builtins.str, Unpack[builtins.tuple[builtins.int, ...]]]" \
65-
# E: Argument 1 to "f" has incompatible type "Tuple[int, ...]"; expected "Tuple[int, Unpack[Tuple[int, ...]]]"
64+
reveal_type(f(var_len_tuple)) # N: Revealed type is "Tuple[builtins.str, Unpack[builtins.tuple[builtins.int, ...]]]"
6665

6766
g_args: Tuple[str, int]
6867
reveal_type(g(g_args)) # N: Revealed type is "Tuple[builtins.str, builtins.str]"

0 commit comments

Comments
 (0)