(self, t: types.Instance)
| 102 | self._visit_type_list(t.arg_types) |
| 103 | |
| 104 | def visit_instance(self, t: types.Instance) -> None: |
| 105 | # Instance is named, record its definition and continue digging into |
| 106 | # components that constitute semantic meaning of this type: bases, metaclass, |
| 107 | # tuple type, and typeddict type. |
| 108 | # Note: we cannot simply record the MRO, in case an intermediate base contains |
| 109 | # a reference to type alias, this affects meaning of map_instance_to_supertype(), |
| 110 | # see e.g. testDoubleReexportGenericUpdated. |
| 111 | self._visit_type_tuple(t.args) |
| 112 | if t.type: |
| 113 | # Important optimization: instead of simply recording the definition and |
| 114 | # recursing into bases, record the MRO and only traverse generic bases. |
| 115 | for s in t.type.mro: |
| 116 | self.modules.add(s.module_name) |
| 117 | for base in s.bases: |
| 118 | if base.args: |
| 119 | self._visit_type_tuple(base.args) |
| 120 | if t.type.metaclass_type: |
| 121 | self._visit(t.type.metaclass_type) |
| 122 | if t.type.typeddict_type: |
| 123 | self._visit(t.type.typeddict_type) |
| 124 | if t.type.tuple_type: |
| 125 | self._visit(t.type.tuple_type) |
| 126 | if t.type.is_protocol: |
| 127 | # For protocols, member types constitute the semantic meaning of the type. |
| 128 | # TODO: this doesn't cover some edge cases, like setter types and exotic nodes. |
| 129 | for m in t.type.protocol_members: |
| 130 | node = t.type.names.get(m) |
| 131 | if node and node.type: |
| 132 | self._visit(node.type) |
| 133 | |
| 134 | def visit_callable_type(self, t: types.CallableType) -> None: |
| 135 | self._visit_type_list(t.arg_types) |
nothing calls this directly
no test coverage detected