|
11 | 11 | from mypy.meet import meet_types
|
12 | 12 | from mypy.types import (
|
13 | 13 | UnboundType, AnyType, CallableType, TupleType, TypeVarDef, Type,
|
14 |
| - Instance, NoneTyp, ErrorType, Overloaded, TypeType, UnionType, UninhabitedType, |
| 14 | + Instance, NoneTyp, Overloaded, TypeType, UnionType, UninhabitedType, |
15 | 15 | true_only, false_only, TypeVarId
|
16 | 16 | )
|
17 | 17 | from mypy.nodes import ARG_POS, ARG_OPT, ARG_STAR, CONTRAVARIANT, INVARIANT, COVARIANT
|
@@ -136,8 +136,7 @@ def assert_expand(self,
|
136 | 136 | # erase_type
|
137 | 137 |
|
138 | 138 | def test_trivial_erase(self) -> None:
|
139 |
| - for t in (self.fx.a, self.fx.o, self.fx.nonet, |
140 |
| - self.fx.anyt, self.fx.err): |
| 139 | + for t in (self.fx.a, self.fx.o, self.fx.nonet, self.fx.anyt): |
141 | 140 | self.assert_erase(t, t)
|
142 | 141 |
|
143 | 142 | def test_erase_with_type_variable(self) -> None:
|
@@ -456,15 +455,6 @@ def test_other_mixed_types(self) -> None:
|
456 | 455 | if str(t1) != str(t2):
|
457 | 456 | self.assert_join(t1, t2, self.fx.o)
|
458 | 457 |
|
459 |
| - def test_error_type(self) -> None: |
460 |
| - self.assert_join(self.fx.err, self.fx.anyt, self.fx.anyt) |
461 |
| - |
462 |
| - # Meet against any type except dynamic results in ErrorType. |
463 |
| - for t in [self.fx.a, self.fx.o, NoneTyp(), UnboundType('x'), |
464 |
| - self.fx.t, self.tuple(), |
465 |
| - self.callable(self.fx.a, self.fx.b)]: |
466 |
| - self.assert_join(t, self.fx.err, self.fx.err) |
467 |
| - |
468 | 458 | def test_simple_generics(self) -> None:
|
469 | 459 | self.assert_join(self.fx.ga, self.fx.ga, self.fx.ga)
|
470 | 460 | self.assert_join(self.fx.ga, self.fx.gb, self.fx.ga)
|
@@ -553,7 +543,7 @@ def test_join_class_types_with_interface_result(self) -> None:
|
553 | 543 | self.assert_join(self.fx.e, self.fx.e2, self.fx.f)
|
554 | 544 |
|
555 | 545 | # Ambiguous result
|
556 |
| - self.assert_join(self.fx.e2, self.fx.e3, self.fx.err) |
| 546 | + self.assert_join(self.fx.e2, self.fx.e3, self.fx.anyt) |
557 | 547 |
|
558 | 548 | def test_generic_interfaces(self) -> None:
|
559 | 549 | self.skip() # FIX
|
@@ -604,12 +594,10 @@ def assert_simple_join(self, s: Type, t: Type, join: Type) -> None:
|
604 | 594 | expected = str(join)
|
605 | 595 | assert_equal(actual, expected,
|
606 | 596 | 'join({}, {}) == {{}} ({{}} expected)'.format(s, t))
|
607 |
| - if not isinstance(s, ErrorType) and not isinstance(result, ErrorType): |
608 |
| - assert_true(is_subtype(s, result), |
609 |
| - '{} not subtype of {}'.format(s, result)) |
610 |
| - if not isinstance(t, ErrorType) and not isinstance(result, ErrorType): |
611 |
| - assert_true(is_subtype(t, result), |
612 |
| - '{} not subtype of {}'.format(t, result)) |
| 597 | + assert_true(is_subtype(s, result), |
| 598 | + '{} not subtype of {}'.format(s, result)) |
| 599 | + assert_true(is_subtype(t, result), |
| 600 | + '{} not subtype of {}'.format(t, result)) |
613 | 601 |
|
614 | 602 | def tuple(self, *a: Type) -> TupleType:
|
615 | 603 | return TupleType(list(a), self.fx.std_tuple)
|
@@ -710,15 +698,6 @@ def test_dynamic_type(self) -> None:
|
710 | 698 | self.callable(self.fx.a, self.fx.b)]:
|
711 | 699 | self.assert_meet(t, self.fx.anyt, t)
|
712 | 700 |
|
713 |
| - def test_error_type(self) -> None: |
714 |
| - self.assert_meet(self.fx.err, self.fx.anyt, self.fx.err) |
715 |
| - |
716 |
| - # Meet against any type except dynamic results in ErrorType. |
717 |
| - for t in [self.fx.a, self.fx.o, NoneTyp(), UnboundType('x'), |
718 |
| - self.fx.t, self.tuple(), |
719 |
| - self.callable(self.fx.a, self.fx.b)]: |
720 |
| - self.assert_meet(t, self.fx.err, self.fx.err) |
721 |
| - |
722 | 701 | def test_simple_generics(self) -> None:
|
723 | 702 | self.assert_meet(self.fx.ga, self.fx.ga, self.fx.ga)
|
724 | 703 | self.assert_meet(self.fx.ga, self.fx.o, self.fx.ga)
|
@@ -805,12 +784,10 @@ def assert_simple_meet(self, s: Type, t: Type, meet: Type) -> None:
|
805 | 784 | expected = str(meet)
|
806 | 785 | assert_equal(actual, expected,
|
807 | 786 | 'meet({}, {}) == {{}} ({{}} expected)'.format(s, t))
|
808 |
| - if not isinstance(s, ErrorType) and not isinstance(result, ErrorType): |
809 |
| - assert_true(is_subtype(result, s), |
810 |
| - '{} not subtype of {}'.format(result, s)) |
811 |
| - if not isinstance(t, ErrorType) and not isinstance(result, ErrorType): |
812 |
| - assert_true(is_subtype(result, t), |
813 |
| - '{} not subtype of {}'.format(result, t)) |
| 787 | + assert_true(is_subtype(result, s), |
| 788 | + '{} not subtype of {}'.format(result, s)) |
| 789 | + assert_true(is_subtype(result, t), |
| 790 | + '{} not subtype of {}'.format(result, t)) |
814 | 791 |
|
815 | 792 | def tuple(self, *a: Type) -> TupleType:
|
816 | 793 | return TupleType(list(a), self.fx.std_tuple)
|
|
0 commit comments