Closed
Description
This test crashes on current master (and causes troubles internally):
[case testFilterIn]
from typing import List, TypeVar, Callable
T = TypeVar('T')
def filter(f: Callable[[T], bool], it: List[T]) -> List[T]: ...
xs: List[int]
filter(lambda x: x in [1, 2] and bool(), [3, 4])
[builtins fixtures/list.pyi]
with a traceback that ends in
File "/Users/ilevkivskyi/src/mypy/mypy/checkexpr.py", line 942, in check_callable_call
callee, args, arg_kinds, formal_to_actual, context)
File "/Users/ilevkivskyi/src/mypy/mypy/checkexpr.py", line 1145, in infer_function_type_arguments
callee_type, args, arg_kinds, formal_to_actual)
File "/Users/ilevkivskyi/src/mypy/mypy/checkexpr.py", line 1043, in infer_arg_types_in_context
res[ai] = self.accept(args[ai], callee.arg_types[i])
File "/Users/ilevkivskyi/src/mypy/mypy/checkexpr.py", line 3723, in accept
typ = node.accept(self)
File "/Users/ilevkivskyi/src/mypy/mypy/nodes.py", line 1852, in accept
return visitor.visit_lambda_expr(self)
File "/Users/ilevkivskyi/src/mypy/mypy/checkexpr.py", line 3334, in visit_lambda_expr
self.chk.check_func_item(e, type_override=type_override)
File "/Users/ilevkivskyi/src/mypy/mypy/checker.py", line 790, in check_func_item
self.check_func_def(defn, typ, name)
File "/Users/ilevkivskyi/src/mypy/mypy/checker.py", line 973, in check_func_def
self.accept(item.body)
File "/Users/ilevkivskyi/src/mypy/mypy/checker.py", line 399, in accept
stmt.accept(self)
File "/Users/ilevkivskyi/src/mypy/mypy/nodes.py", line 1004, in accept
return visitor.visit_block(self)
File "/Users/ilevkivskyi/src/mypy/mypy/checker.py", line 1970, in visit_block
self.accept(s)
File "/Users/ilevkivskyi/src/mypy/mypy/checker.py", line 399, in accept
stmt.accept(self)
File "/Users/ilevkivskyi/src/mypy/mypy/nodes.py", line 1140, in accept
return visitor.visit_return_stmt(self)
File "/Users/ilevkivskyi/src/mypy/mypy/checker.py", line 3090, in visit_return_stmt
self.check_return_stmt(s)
File "/Users/ilevkivskyi/src/mypy/mypy/checker.py", line 3123, in check_return_stmt
s.expr, return_type, allow_none_return=allow_none_func_call))
File "/Users/ilevkivskyi/src/mypy/mypy/checkexpr.py", line 3723, in accept
typ = node.accept(self)
File "/Users/ilevkivskyi/src/mypy/mypy/nodes.py", line 1736, in accept
return visitor.visit_op_expr(self)
File "/Users/ilevkivskyi/src/mypy/mypy/checkexpr.py", line 2077, in visit_op_expr
return self.check_boolean_op(e, e)
File "/Users/ilevkivskyi/src/mypy/mypy/checkexpr.py", line 2703, in check_boolean_op
right_map, left_map = self.chk.find_isinstance_check(e.left)
File "/Users/ilevkivskyi/src/mypy/mypy/checker.py", line 3811, in find_isinstance_check
if_map, else_map = self.find_isinstance_check_helper(node)
File "/Users/ilevkivskyi/src/mypy/mypy/checker.py", line 3926, in find_isinstance_check_helper
if is_overlapping_erased_types(item_type, collection_item_type):
File "/Users/ilevkivskyi/src/mypy/mypy/meet.py", line 361, in is_overlapping_erased_types
return is_overlapping_types(erase_type(left), erase_type(right),
File "/Users/ilevkivskyi/src/mypy/mypy/erasetype.py", line 25, in erase_type
return typ.accept(EraseTypeVisitor())
File "/Users/ilevkivskyi/src/mypy/mypy/types.py", line 694, in accept
return visitor.visit_erased_type(self)
File "/Users/ilevkivskyi/src/mypy/mypy/erasetype.py", line 45, in visit_erased_type
raise RuntimeError()
RuntimeError:
This may be related to #8148, also note there is a weird pass
here (it should probably be continue
).
cc @Michael0x2a