@@ -499,15 +499,21 @@ class TypeVisitor(Generic[T]):
499
499
The parameter T is the return type of the visit methods.
500
500
"""
501
501
502
+ def _notimplemented_helper (self ) -> NotImplementedError :
503
+ return NotImplementedError ("Method visit_type_list not implemented in "
504
+ + "'{}'\n " .format (type (self ).__name__ )
505
+ + "This is a known bug, track development in "
506
+ + "'https://github.com/JukkaL/mypy/issues/730'" )
507
+
502
508
@abstractmethod
503
509
def visit_unbound_type (self , t : UnboundType ) -> T :
504
510
pass
505
511
506
512
def visit_type_list (self , t : TypeList ) -> T :
507
- pass
513
+ raise self . _notimplemented_helper ()
508
514
509
515
def visit_error_type (self , t : ErrorType ) -> T :
510
- pass
516
+ raise self . _notimplemented_helper ()
511
517
512
518
@abstractmethod
513
519
def visit_any (self , t : AnyType ) -> T :
@@ -522,7 +528,7 @@ def visit_none_type(self, t: NoneTyp) -> T:
522
528
pass
523
529
524
530
def visit_erased_type (self , t : ErasedType ) -> T :
525
- pass
531
+ raise self . _notimplemented_helper ()
526
532
527
533
@abstractmethod
528
534
def visit_type_var (self , t : TypeVarType ) -> T :
@@ -537,21 +543,21 @@ def visit_callable_type(self, t: CallableType) -> T:
537
543
pass
538
544
539
545
def visit_overloaded (self , t : Overloaded ) -> T :
540
- pass
546
+ raise self . _notimplemented_helper ()
541
547
542
548
@abstractmethod
543
549
def visit_tuple_type (self , t : TupleType ) -> T :
544
550
pass
545
551
546
552
def visit_star_type (self , t : StarType ) -> T :
547
- pass
553
+ raise self . _notimplemented_helper ()
548
554
549
555
@abstractmethod
550
556
def visit_union_type (self , t : UnionType ) -> T :
551
557
pass
552
558
553
559
def visit_ellipsis_type (self , t : EllipsisType ) -> T :
554
- pass
560
+ raise self . _notimplemented_helper ()
555
561
556
562
557
563
class TypeTranslator (TypeVisitor [Type ]):
0 commit comments