Skip to content

Commit 2517710

Browse files
committed
Delete DeletedType
1 parent ae548ef commit 2517710

File tree

13 files changed

+12
-91
lines changed

13 files changed

+12
-91
lines changed

mypy/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from mypy.types import (
3333
Type, AnyType, CallableType, Void, FunctionLike, Overloaded, TupleType,
3434
Instance, NoneTyp, ErrorType, strip_type,
35-
UnionType, TypeVarId, TypeVarType, PartialType, DeletedType, UninhabitedType
35+
UnionType, TypeVarId, TypeVarType, PartialType, UninhabitedType
3636
)
3737
from mypy.sametypes import is_same_type
3838
from mypy.messages import MessageBuilder

mypy/checkexpr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from mypy.types import (
66
Type, AnyType, CallableType, Overloaded, NoneTyp, Void, TypeVarDef,
77
TupleType, Instance, TypeVarId, TypeVarType, ErasedType, UnionType,
8-
PartialType, DeletedType, UnboundType, UninhabitedType, TypeType
8+
PartialType, UnboundType, UninhabitedType, TypeType
99
)
1010
from mypy.nodes import (
1111
NameExpr, RefExpr, Var, FuncDef, OverloadedFuncDef, TypeInfo, CallExpr,

mypy/checkmember.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
from mypy.types import (
66
Type, Instance, AnyType, TupleType, CallableType, FunctionLike, TypeVarId, TypeVarDef,
7-
Overloaded, TypeVarType, TypeTranslator, UnionType, PartialType,
8-
DeletedType, NoneTyp, TypeType
7+
Overloaded, TypeVarType, TypeTranslator, UnionType, PartialType, NoneTyp, TypeType
98
)
109
from mypy.nodes import TypeInfo, FuncBase, Var, FuncDef, SymbolNode, Context
1110
from mypy.nodes import ARG_POS, ARG_STAR, ARG_STAR2, function_type, Decorator, OverloadedFuncDef

mypy/constraints.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from mypy.types import (
66
CallableType, Type, TypeVisitor, UnboundType, AnyType, Void, NoneTyp, TypeVarType,
7-
Instance, TupleType, UnionType, Overloaded, ErasedType, PartialType, DeletedType,
7+
Instance, TupleType, UnionType, Overloaded, ErasedType, PartialType,
88
UninhabitedType, TypeType, TypeVarId, is_named_instance
99
)
1010
from mypy.maptype import map_instance_to_supertype
@@ -228,9 +228,6 @@ def visit_uninhabited_type(self, template: UninhabitedType) -> List[Constraint]:
228228
def visit_erased_type(self, template: ErasedType) -> List[Constraint]:
229229
return []
230230

231-
def visit_deleted_type(self, template: DeletedType) -> List[Constraint]:
232-
return []
233-
234231
# Errors
235232

236233
def visit_partial_type(self, template: PartialType) -> List[Constraint]:

mypy/erasetype.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from mypy.types import (
44
Type, TypeVisitor, UnboundType, ErrorType, AnyType, Void, NoneTyp, TypeVarId,
55
Instance, TypeVarType, CallableType, TupleType, UnionType, Overloaded, ErasedType,
6-
PartialType, DeletedType, TypeTranslator, TypeList, UninhabitedType, TypeType
6+
PartialType, TypeTranslator, TypeList, UninhabitedType, TypeType
77
)
88

99

@@ -54,9 +54,6 @@ def visit_partial_type(self, t: PartialType) -> Type:
5454
# Should not get here.
5555
raise RuntimeError()
5656

57-
def visit_deleted_type(self, t: DeletedType) -> Type:
58-
return t
59-
6057
def visit_instance(self, t: Instance) -> Type:
6158
return Instance(t.type, [AnyType()] * len(t.args), t.line)
6259

mypy/expandtype.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from mypy.types import (
44
Type, Instance, CallableType, TypeVisitor, UnboundType, ErrorType, AnyType,
55
Void, NoneTyp, TypeVarType, Overloaded, TupleType, UnionType, ErasedType, TypeList,
6-
PartialType, DeletedType, UninhabitedType, TypeType, TypeVarId
6+
PartialType, UninhabitedType, TypeType, TypeVarId
77
)
88

99

@@ -57,9 +57,6 @@ def visit_none_type(self, t: NoneTyp) -> Type:
5757
def visit_uninhabited_type(self, t: UninhabitedType) -> Type:
5858
return t
5959

60-
def visit_deleted_type(self, t: DeletedType) -> Type:
61-
return t
62-
6360
def visit_erased_type(self, t: ErasedType) -> Type:
6461
# Should not get here.
6562
raise RuntimeError()

mypy/join.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from mypy.types import (
66
Type, AnyType, NoneTyp, Void, TypeVisitor, Instance, UnboundType,
77
ErrorType, TypeVarType, CallableType, TupleType, ErasedType, TypeList,
8-
UnionType, FunctionLike, Overloaded, PartialType, DeletedType,
8+
UnionType, FunctionLike, Overloaded, PartialType,
99
UninhabitedType, TypeType
1010
)
1111
from mypy.maptype import map_instance_to_supertype
@@ -128,12 +128,6 @@ def visit_uninhabited_type(self, t: UninhabitedType) -> Type:
128128
else:
129129
return self.default(self.s)
130130

131-
def visit_deleted_type(self, t: DeletedType) -> Type:
132-
if not isinstance(self.s, Void):
133-
return self.s
134-
else:
135-
return self.default(self.s)
136-
137131
def visit_erased_type(self, t: ErasedType) -> Type:
138132
return self.s
139133

mypy/meet.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from mypy.types import (
55
Type, AnyType, TypeVisitor, UnboundType, Void, ErrorType, NoneTyp, TypeVarType,
66
Instance, CallableType, TupleType, ErasedType, TypeList, UnionType, PartialType,
7-
DeletedType, UninhabitedType, TypeType
7+
UninhabitedType, TypeType
88
)
99
from mypy.subtypes import is_subtype
1010
from mypy.nodes import TypeInfo
@@ -173,20 +173,6 @@ def visit_uninhabited_type(self, t: UninhabitedType) -> Type:
173173
else:
174174
return ErrorType()
175175

176-
def visit_deleted_type(self, t: DeletedType) -> Type:
177-
if not isinstance(self.s, Void) and not isinstance(self.s, ErrorType):
178-
if isinstance(self.s, NoneTyp):
179-
if experiments.STRICT_OPTIONAL:
180-
return t
181-
else:
182-
return self.s
183-
elif isinstance(self.s, UninhabitedType):
184-
return self.s
185-
else:
186-
return t
187-
else:
188-
return ErrorType()
189-
190176
def visit_erased_type(self, t: ErasedType) -> Type:
191177
return self.s
192178

mypy/messages.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from mypy.errors import Errors
1212
from mypy.types import (
1313
Type, CallableType, Instance, TypeVarType, TupleType, UnionType, Void, NoneTyp, AnyType,
14-
Overloaded, FunctionLike, DeletedType, TypeType
14+
Overloaded, FunctionLike, TypeType
1515
)
1616
from mypy.nodes import (
1717
TypeInfo, Context, MypyFile, op_methods, FuncDef, reverse_type_aliases,
@@ -271,8 +271,6 @@ def format_simple(self, typ: Type, verbosity: int = 0) -> str:
271271
return 'None'
272272
elif isinstance(typ, AnyType):
273273
return '"Any"'
274-
elif isinstance(typ, DeletedType):
275-
return '<deleted>'
276274
elif isinstance(typ, TypeType):
277275
return 'Type[{}]'.format(
278276
strip_quotes(self.format_simple(typ.item, verbosity)))

mypy/sametypes.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from mypy.types import (
44
Type, UnboundType, ErrorType, AnyType, NoneTyp, Void, TupleType, UnionType, CallableType,
55
TypeVarType, Instance, TypeVisitor, ErasedType, TypeList, Overloaded, PartialType,
6-
DeletedType, UninhabitedType, TypeType
6+
UninhabitedType, TypeType
77
)
88

99

@@ -80,9 +80,6 @@ def visit_erased_type(self, left: ErasedType) -> bool:
8080
# any other type, even another ErasedType.
8181
return False
8282

83-
def visit_deleted_type(self, left: DeletedType) -> bool:
84-
return isinstance(self.right, DeletedType)
85-
8683
def visit_instance(self, left: Instance) -> bool:
8784
return (isinstance(self.right, Instance) and
8885
left.type == self.right.type and

0 commit comments

Comments
 (0)