Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bd3c60a
Creating if branch to check for TupleExpr
Malika1109 Dec 1, 2023
8a0aee6
Checking if all elements iin the TupleExpr are enums
Malika1109 Dec 1, 2023
23d13f9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 1, 2023
f73e3fa
Fixed indent issues
Malika1109 Dec 1, 2023
aaec558
Merge branch 'in-exhaustive-checking' of https://github.com/Malika110…
Malika1109 Dec 1, 2023
e14adcb
Modified operators.py
Malika1109 Dec 1, 2023
018cf15
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 1, 2023
38102c7
Fixed formatting issues
Malika1109 Dec 1, 2023
a3fb558
Merge branch 'master' into in-exhaustive-checking
Malika1109 Dec 1, 2023
cd9826c
Merging purposes commit
Malika1109 Dec 1, 2023
ec1c3d4
Merging purposes commit
Malika1109 Dec 1, 2023
526f430
Resolved merge conflicts in typinig_extensions.pyi
Malika1109 Dec 1, 2023
605f66c
Resolved merge conflicts in typinig_extensions.pyi
Malika1109 Dec 1, 2023
c70b3f1
Merge pull request #1 from python/master
Malika1109 Dec 1, 2023
b56ab60
Resolved formatting issues
Malika1109 Dec 1, 2023
8116d9f
Merge branch 'master' of https://github.com/Malika1109/mypy into in-e…
Malika1109 Dec 1, 2023
090bc6f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 1, 2023
2df876c
Modified pyproject.tomll for ruff error
Malika1109 Dec 2, 2023
4a9e582
Made changes to handling of in for open-source errors
Malika1109 Dec 4, 2023
9bd590e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 4, 2023
6dd351c
Changed handling of in operator
Malika1109 Dec 4, 2023
17e1b7e
Changed handling of in operator
Malika1109 Dec 4, 2023
30b6cae
successfully created the check-in-exhaustive-checking-3.test file for…
a-khaldi Dec 5, 2023
fc611bc
removed the 3 in the name of the file for clarity + began the test wi…
a-khaldi Dec 5, 2023
4d38b0b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 5, 2023
4420ed8
testing is done without any comments, want to make sure it passes bef…
a-khaldi Dec 5, 2023
652caa4
testing is done without any comments, want to make sure it passes bef…
a-khaldi Dec 5, 2023
b4bf17a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 5, 2023
55d3b2f
removed unneeded comments & code
ssaloos Dec 5, 2023
16ca296
Delete feature-test.py for PR
GulnazSerikbay Dec 5, 2023
e7694a8
added comments for clarity and minor changes to in exhaustive checkin…
Dec 6, 2023
64a8ab5
added some enum type extraction + test
GulnazSerikbay Dec 6, 2023
6973a96
Merge branch
GulnazSerikbay Dec 6, 2023
5a060f7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 6, 2023
8144105
small fix
GulnazSerikbay Dec 6, 2023
69aec40
merge for pull and push
GulnazSerikbay Dec 6, 2023
046370e
removed some code
GulnazSerikbay Dec 6, 2023
06c8d98
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 6, 2023
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
Prev Previous commit
Next Next commit
removed unneeded comments & code
  • Loading branch information
ssaloos committed Dec 5, 2023
commit 55d3b2f5348c1ec100604b99eda4d8b480e74639
25 changes: 1 addition & 24 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5800,7 +5800,6 @@ def has_no_custom_eq_checks(t: Type) -> bool:
is_valid_target,
coerce_only_in_literal_context,
)
# print("done2", if_map, else_map)

# Strictly speaking, we should also skip this check if the objects in the expr
# chain have custom __eq__ or __ne__ methods. But we (maybe optimistically)
Expand All @@ -5813,10 +5812,8 @@ def has_no_custom_eq_checks(t: Type) -> bool:
expr_indices,
narrowable_operand_index_to_hash.keys(),
)
# print("done3", if_map, else_map)

# If we haven't been able to narrow types yet, we might be dealing with a
# explicit type(x) == some_type check
# If we haven't been able to narrow types yet, we might be dealing with a explicit type(x) == some_type check
if if_map == {} and else_map == {}:
if_map, else_map = self.find_type_equals_check(node, expr_indices)
# print("done4", if_map, else_map)
Expand All @@ -5825,13 +5822,9 @@ def has_no_custom_eq_checks(t: Type) -> bool:
left_index, right_index = expr_indices
item_type = operand_types[left_index]
iterable_type = operand_types[right_index]
# added by me
right_expr = operands[right_index]

if_map, else_map = {}, {}
# print(left_index, "\n")
# print(right_index, "\n")
# print(narrowable_operand_index_to_hash, "\n")

if isinstance(right_expr, TupleExpr):
all_literal_enum = all(
Expand All @@ -5844,13 +5837,11 @@ def has_no_custom_eq_checks(t: Type) -> bool:

else:
if left_index in narrowable_operand_index_to_hash:
# print("left in")
# We only try and narrow away 'None' for now
if is_overlapping_none(item_type):
collection_item_type = get_proper_type(
builtin_item_type(iterable_type)
)
# print("done5", if_map, else_map)
if (
collection_item_type is not None
and not is_overlapping_none(collection_item_type)
Expand All @@ -5864,41 +5855,27 @@ def has_no_custom_eq_checks(t: Type) -> bool:
):
if_map[operands[left_index]] = remove_optional(item_type)

# print("done6", if_map, else_map)

if right_index in narrowable_operand_index_to_hash:
# print("right in")
if_type, else_type = self.conditional_types_for_iterable(
item_type, iterable_type
)
expr = operands[right_index]
# print("done7", if_map, else_map)

if if_type is None:
if_map = None
# print("done8", if_map, else_map)
else:
if_map[expr] = if_type
# print("done9", if_map, else_map)

if else_type is None:
else_map = None
# print("done11", if_map, else_map)
else:
else_map[expr] = else_type

# print("done12", if_map, else_map)

else:
if_map = {}
else_map = {}
# print("done13", if_map, else_map)

if operator in {"is not", "!=", "not in"}:
if_map, else_map = else_map, if_map

# print("done14", if_map, else_map)

partial_type_maps.append((if_map, else_map))

# If we have found non-trivial restrictions from the regular comparisons,
Expand Down