(self, var: Var, context: Context)
| 445 | return AnyType(TypeOfAny.from_error) |
| 446 | |
| 447 | def analyze_var_ref(self, var: Var, context: Context) -> Type: |
| 448 | if var.type: |
| 449 | var_type = get_proper_type(var.type) |
| 450 | if isinstance(var_type, Instance): |
| 451 | if var.fullname == "typing.Any": |
| 452 | # The typeshed type is 'object'; give a more useful type in runtime context |
| 453 | return self.named_type("typing._SpecialForm") |
| 454 | if self.is_literal_context() and var_type.last_known_value is not None: |
| 455 | return var_type.last_known_value |
| 456 | if var.name in {"True", "False"}: |
| 457 | return self.infer_literal_expr_type(var.name == "True", "builtins.bool") |
| 458 | return var.type |
| 459 | else: |
| 460 | if not var.is_ready and self.chk.in_checked_function(): |
| 461 | self.chk.handle_cannot_determine_type(var.name, context) |
| 462 | # Implicit 'Any' type. |
| 463 | return AnyType(TypeOfAny.special_form) |
| 464 | |
| 465 | def module_type(self, node: MypyFile) -> Instance: |
| 466 | try: |
no test coverage detected