Recheck a function while assuming it has type typ. Return all error messages.
(self, func: FuncDef, typ: ProperType)
| 684 | return node.func |
| 685 | |
| 686 | def try_type(self, func: FuncDef, typ: ProperType) -> list[str]: |
| 687 | """Recheck a function while assuming it has type typ. |
| 688 | |
| 689 | Return all error messages. |
| 690 | """ |
| 691 | old = func.unanalyzed_type |
| 692 | # During reprocessing, unanalyzed_type gets copied to type (by aststrip). |
| 693 | # We set type to None to ensure that the type always changes during |
| 694 | # reprocessing. |
| 695 | func.type = None |
| 696 | func.unanalyzed_type = typ |
| 697 | try: |
| 698 | res = self.fgmanager.trigger(func.fullname) |
| 699 | # if res: |
| 700 | # print('===', typ) |
| 701 | # print('\n'.join(res)) |
| 702 | return res |
| 703 | finally: |
| 704 | func.unanalyzed_type = old |
| 705 | |
| 706 | def reload(self, state: State) -> list[str]: |
| 707 | """Recheck the module given by state.""" |
no test coverage detected