Skip to content

Commit 00ffdcb

Browse files
committed
Erase to explicit Anys: when we erase to special_form, subsequent overloads will pick the first overload again...
1 parent 3ee9c95 commit 00ffdcb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mypy/erasetype.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,29 +79,29 @@ def visit_deleted_type(self, t: DeletedType) -> ProperType:
7979
return t
8080

8181
def visit_instance(self, t: Instance) -> ProperType:
82-
args = erased_vars(t.type.defn.type_vars, TypeOfAny.special_form)
82+
args = erased_vars(t.type.defn.type_vars, TypeOfAny.explicit)
8383
return Instance(t.type, args, t.line)
8484

8585
def visit_type_var(self, t: TypeVarType) -> ProperType:
86-
return AnyType(TypeOfAny.special_form)
86+
return AnyType(TypeOfAny.explicit)
8787

8888
def visit_param_spec(self, t: ParamSpecType) -> ProperType:
89-
return AnyType(TypeOfAny.special_form)
89+
return AnyType(TypeOfAny.explicit)
9090

9191
def visit_parameters(self, t: Parameters) -> ProperType:
9292
raise RuntimeError("Parameters should have been bound to a class")
9393

9494
def visit_type_var_tuple(self, t: TypeVarTupleType) -> ProperType:
9595
# Likely, we can never get here because of aggressive erasure of types that
9696
# can contain this, but better still return a valid replacement.
97-
return t.tuple_fallback.copy_modified(args=[AnyType(TypeOfAny.special_form)])
97+
return t.tuple_fallback.copy_modified(args=[AnyType(TypeOfAny.explicit)])
9898

9999
def visit_unpack_type(self, t: UnpackType) -> ProperType:
100-
return AnyType(TypeOfAny.special_form)
100+
return AnyType(TypeOfAny.explicit)
101101

102102
def visit_callable_type(self, t: CallableType) -> ProperType:
103103
# We must preserve the fallback type for overload resolution to work.
104-
any_type = AnyType(TypeOfAny.special_form)
104+
any_type = AnyType(TypeOfAny.explicit)
105105
return CallableType(
106106
arg_types=[any_type, any_type],
107107
arg_kinds=[ARG_STAR, ARG_STAR2],

0 commit comments

Comments
 (0)