|
3 | 3 | from mypy.types import (
|
4 | 4 | Type, TypeVisitor, UnboundType, AnyType, NoneTyp, TypeVarId, Instance, TypeVarType,
|
5 | 5 | CallableType, TupleType, TypedDictType, UnionType, Overloaded, ErasedType, PartialType,
|
6 |
| - DeletedType, TypeTranslator, UninhabitedType, TypeType, TypeOfAny |
| 6 | + DeletedType, TypeTranslator, UninhabitedType, TypeType, TypeOfAny, LiteralType, |
7 | 7 | )
|
8 | 8 | from mypy.nodes import ARG_STAR, ARG_STAR2
|
9 | 9 |
|
@@ -78,6 +78,12 @@ def visit_tuple_type(self, t: TupleType) -> Type:
|
78 | 78 | def visit_typeddict_type(self, t: TypedDictType) -> Type:
|
79 | 79 | return t.fallback.accept(self)
|
80 | 80 |
|
| 81 | + def visit_literal_type(self, t: LiteralType) -> Type: |
| 82 | + # The fallback for literal types should always be either |
| 83 | + # something like int or str, or an enum class -- types that |
| 84 | + # don't contain any TypeVars. So there's no need to visit it. |
| 85 | + return t |
| 86 | + |
81 | 87 | def visit_union_type(self, t: UnionType) -> Type:
|
82 | 88 | erased_items = [erase_type(item) for item in t.items]
|
83 | 89 | return UnionType.make_simplified_union(erased_items)
|
|
0 commit comments