You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In certain circumstances the daemon will crash with an array out of bounds error when a type parameter is removed from a class:
[case testRemoveGeneric]
[file a.py]
from typing import Generic, TypeVar
T = TypeVar('T')
class A(Generic[T]): pass
[file a.py.2]
from typing import Generic, TypeVar
T = TypeVar('T')
class A: pass
[file b.py]
from a import A
from d import take
def foo() -> None:
take([A()])
[file d.py]
from typing import List
from a import A
def take(x: List[A]): pass
[builtins fixtures/list.pyi]
[out]
==
crashes with a traceback ending in
File "/home/msullivan/src/mypy/mypy/checkexpr.py", line 812, in check_callable_call
callee, args, arg_kinds, formal_to_actual, context)
File "/home/msullivan/src/mypy/mypy/checkexpr.py", line 1027, in infer_function_type_arguments
strict=self.chk.in_checked_function())
File "/home/msullivan/src/mypy/mypy/infer.py", line 31, in infer_function_type_arguments
callee_type, arg_types, arg_kinds, formal_to_actual)
File "/home/msullivan/src/mypy/mypy/constraints.py", line 63, in infer_constraints_for_callable
c = infer_constraints(callee.arg_types[i], actual_type, SUPERTYPE_OF)
File "/home/msullivan/src/mypy/mypy/constraints.py", line 140, in infer_constraints
return template.accept(ConstraintBuilderVisitor(actual, direction))
File "/home/msullivan/src/mypy/mypy/types.py", line 667, in accept
return visitor.visit_instance(self)
File "/home/msullivan/src/mypy/mypy/constraints.py", line 325, in visit_instance
if tvars[j].variance != CONTRAVARIANT:
The text was updated successfully, but these errors were encountered:
Isn't it just a duplicate of #3279 but "reversed" (in the existing issue, the out of bound errors appear when a non-generic class is turned into generic)?
Actually the original issue has a recipe for this "direction" too, see #3279 (comment) (although the crash actually happens in a different visitor I believe the cause is the same).
In certain circumstances the daemon will crash with an array out of bounds error when a type parameter is removed from a class:
crashes with a traceback ending in
The text was updated successfully, but these errors were encountered: