Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now all .clean_copy() calls do not use .disable_count = 0 #11459

Merged
merged 3 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
1 change: 0 additions & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4674,7 +4674,6 @@ def refine_parent_types(self,

def replay_lookup(new_parent_type: ProperType) -> Optional[Type]:
msg_copy = self.msg.clean_copy()
msg_copy.disable_count = 0
member_type = analyze_member_access(
name=member_name,
typ=new_parent_type,
Expand Down
15 changes: 7 additions & 8 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2488,9 +2488,7 @@ def check_op_reversible(self,
msg: MessageBuilder) -> Tuple[Type, Type]:
def make_local_errors() -> MessageBuilder:
"""Creates a new MessageBuilder object."""
local_errors = msg.clean_copy()
local_errors.disable_count = 0
return local_errors
return msg.clean_copy()

def lookup_operator(op_name: str, base_type: Type) -> Optional[Type]:
"""Looks up the given operator and returns the corresponding type,
Expand Down Expand Up @@ -2703,7 +2701,6 @@ def check_op(self, method: str, base_type: Type,
# just the left ones. (Mypy can sometimes perform some more precise inference
# if we leave the right operands a union -- see testOperatorWithEmptyListAndSum.)
msg = self.msg.clean_copy()
msg.disable_count = 0
all_results = []
all_inferred = []

Expand Down Expand Up @@ -2738,11 +2735,13 @@ def check_op(self, method: str, base_type: Type,
right_variants = [(right_type, arg)]
right_type = get_proper_type(right_type)
if isinstance(right_type, UnionType):
right_variants = [(item, TempNode(item, context=context))
for item in flatten_nested_unions(right_type.relevant_items(),
handle_type_alias_type=True)]
right_variants = [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is unrelated, but it was completely unreadable:
Снимок экрана 2021-11-04 в 19 22 36

After:
Снимок экрана 2021-11-04 в 19 25 41

(item, TempNode(item, context=context))
for item in flatten_nested_unions(right_type.relevant_items(),
handle_type_alias_type=True)
]

msg = self.msg.clean_copy()
msg.disable_count = 0
all_results = []
all_inferred = []

Expand Down