Commit 6c8e0cc
Ignore position if imprecise arguments are matched by name (#16471)
Fixes #16405
Fixes #16412
Imprecise argument kinds inference was added a while ago to support
various edge cases with `ParamSpec`. This feature required mapping
actual kinds to formal kinds, which is in general undecidable. At that
time we decided to not add much special-casing, and wait for some real
use-cases. So far there are two relevant issues, and it looks like both
of them can be fixed with simple special-casing: ignore argument
positions in subtyping if arguments can be matched by name. This adds
minor unsafety, and generally doesn't look bad, so I think we should go
ahead with it.
---------
Co-authored-by: Alex Waygood <[email protected]>1 parent 5c354c4 commit 6c8e0cc
File tree
2 files changed
+73
-6
lines changed- mypy
- test-data/unit
2 files changed
+73
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1651 | 1651 | | |
1652 | 1652 | | |
1653 | 1653 | | |
1654 | | - | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
1655 | 1660 | | |
1656 | 1661 | | |
1657 | 1662 | | |
| |||
1676 | 1681 | | |
1677 | 1682 | | |
1678 | 1683 | | |
1679 | | - | |
1680 | | - | |
1681 | 1684 | | |
| 1685 | + | |
| 1686 | + | |
1682 | 1687 | | |
1683 | 1688 | | |
1684 | 1689 | | |
| |||
1711 | 1716 | | |
1712 | 1717 | | |
1713 | 1718 | | |
1714 | | - | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
1715 | 1724 | | |
1716 | 1725 | | |
1717 | 1726 | | |
| |||
1735 | 1744 | | |
1736 | 1745 | | |
1737 | 1746 | | |
| 1747 | + | |
1738 | 1748 | | |
1739 | 1749 | | |
1740 | 1750 | | |
| |||
1749 | 1759 | | |
1750 | 1760 | | |
1751 | 1761 | | |
| 1762 | + | |
| 1763 | + | |
1752 | 1764 | | |
1753 | 1765 | | |
1754 | | - | |
| 1766 | + | |
1755 | 1767 | | |
1756 | 1768 | | |
1757 | 1769 | | |
| |||
1779 | 1791 | | |
1780 | 1792 | | |
1781 | 1793 | | |
1782 | | - | |
| 1794 | + | |
1783 | 1795 | | |
1784 | 1796 | | |
1785 | 1797 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1687 | 1687 | | |
1688 | 1688 | | |
1689 | 1689 | | |
| 1690 | + | |
1690 | 1691 | | |
1691 | 1692 | | |
1692 | 1693 | | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
1693 | 1702 | | |
1694 | 1703 | | |
1695 | 1704 | | |
| |||
2087 | 2096 | | |
2088 | 2097 | | |
2089 | 2098 | | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
2090 | 2145 | | |
2091 | 2146 | | |
2092 | 2147 | | |
| |||
0 commit comments