(t: Type, s: Type)
| 793 | |
| 794 | |
| 795 | def safe_meet(t: Type, s: Type) -> Type: |
| 796 | # Similar to above but for meet_types(). |
| 797 | from mypy.meet import meet_types |
| 798 | |
| 799 | if not isinstance(t, UnpackType) and not isinstance(s, UnpackType): |
| 800 | return meet_types(t, s) |
| 801 | if isinstance(t, UnpackType) and isinstance(s, UnpackType): |
| 802 | unpacked = get_proper_type(t.type) |
| 803 | if isinstance(unpacked, TypeVarTupleType): |
| 804 | fallback_type = unpacked.tuple_fallback.type |
| 805 | elif isinstance(unpacked, TupleType): |
| 806 | fallback_type = unpacked.partial_fallback.type |
| 807 | else: |
| 808 | assert isinstance(unpacked, Instance) and unpacked.type.fullname == "builtins.tuple" |
| 809 | fallback_type = unpacked.type |
| 810 | res = meet_types(t.type, s.type) |
| 811 | if isinstance(res, UninhabitedType): |
| 812 | res = Instance(fallback_type, [res]) |
| 813 | return UnpackType(res) |
| 814 | return UninhabitedType() |
| 815 | |
| 816 | |
| 817 | def combine_similar_callables(t: CallableType, s: CallableType) -> CallableType: |
no test coverage detected
searching dependent graphs…