Skip to content

Commit

Permalink
Changes how errors are disabled in visit_comparison_expr (#11451)
Browse files Browse the repository at this point in the history
It now has a better API for that. Change `copy()` -> `clean_copy()`.
  • Loading branch information
sobolevn authored Nov 4, 2021
1 parent cd75e5b commit 1f4e10e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2230,10 +2230,15 @@ def visit_comparison_expr(self, e: ComparisonExpr) -> Type:

# Keep track of whether we get type check errors (these won't be reported, they
# are just to verify whether something is valid typing wise).
local_errors = self.msg.copy()
local_errors.disable_count = 0
local_errors = self.msg.clean_copy()
_, method_type = self.check_method_call_by_name(
'__contains__', right_type, [left], [ARG_POS], e, local_errors)
method='__contains__',
base_type=right_type,
args=[left],
arg_kinds=[ARG_POS],
context=e,
local_errors=local_errors,
)
sub_result = self.bool_type()
# Container item type for strict type overlap checks. Note: we need to only
# check for nominal type, because a usual "Unsupported operands for in"
Expand Down

0 comments on commit 1f4e10e

Please sign in to comment.