Skip to content

Commit e5b617c

Browse files
committed
1 parent 8b73cc2 commit e5b617c

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

mypy/main.py

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ reveal_type(f(f_args3)) # N: Revealed type is "Tuple[builtins.str, builtins.str
6060
f(empty) # E: Argument 1 to "f" has incompatible type "Tuple[()]"; expected "Tuple[int]"
6161
f(bad_args) # E: Argument 1 to "f" has incompatible type "Tuple[str, str]"; expected "Tuple[int, str]"
6262

63-
# 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, ...]]]"
63+
reveal_type(f(var_len_tuple)) # N: Revealed type is "Tuple[builtins.str, Unpack[builtins.tuple[builtins.int, ...]]]"
6664

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

0 commit comments

Comments
 (0)