(self, o: SingletonPattern)
| 216 | return PatternType(ok_type, rest_type, {}) |
| 217 | |
| 218 | def visit_singleton_pattern(self, o: SingletonPattern) -> PatternType: |
| 219 | current_type = self.type_context[-1] |
| 220 | value: bool | None = o.value |
| 221 | if isinstance(value, bool): |
| 222 | typ = self.chk.expr_checker.infer_literal_expr_type(value, "builtins.bool") |
| 223 | elif value is None: |
| 224 | typ = NoneType() |
| 225 | else: |
| 226 | assert False |
| 227 | |
| 228 | narrowed_type, rest_type = self.chk.conditional_types_with_intersection( |
| 229 | current_type, [get_type_range(typ)], o, default=current_type |
| 230 | ) |
| 231 | return PatternType(narrowed_type, rest_type, {}) |
| 232 | |
| 233 | def visit_sequence_pattern(self, o: SequencePattern) -> PatternType: |
| 234 | # |
nothing calls this directly
no test coverage detected