(self, o: AsPattern)
| 135 | return result |
| 136 | |
| 137 | def visit_as_pattern(self, o: AsPattern) -> PatternType: |
| 138 | current_type = self.type_context[-1] |
| 139 | if o.pattern is not None: |
| 140 | pattern_type = self.accept(o.pattern, current_type) |
| 141 | typ, rest_type, type_map = pattern_type |
| 142 | else: |
| 143 | typ, rest_type, type_map = current_type, UninhabitedType(), {} |
| 144 | |
| 145 | if not is_uninhabited(typ) and o.name is not None: |
| 146 | typ, _ = self.chk.conditional_types_with_intersection( |
| 147 | current_type, [get_type_range(typ)], o, default=current_type |
| 148 | ) |
| 149 | if not is_uninhabited(typ): |
| 150 | type_map[o.name] = typ |
| 151 | |
| 152 | return PatternType(typ, rest_type, type_map) |
| 153 | |
| 154 | def visit_or_pattern(self, o: OrPattern) -> PatternType: |
| 155 | current_type = self.type_context[-1] |
nothing calls this directly
no test coverage detected