Commit ab4e754
committed
Sema: Don't stick CovariantReturnConversionExpr around property access with DynamicSelfType base
It could be that refTy->hasDynamicSelfType() is true whereas
varDecl->getValueInterfaceType()->hasDynamicSelfType() is false.
This happens if the base of the access is dynamic Self, so the
refTy is (Self) -> @lvalue Int or whatever.
Note that replaceDynamicSelfType() behaves correctly in this case;
it leaves that Self in place, because it's in contravariant
position.
However, the other place where we check the condition would then
form a nonsensical CovariantReturnConversionExpr around the result
of the access, even though no conversion was necessary here; the
type of the returned value does not involve Self.
Simplify this logic further with the correct condition.
Fixes rdar://159531634.1 parent e5f9ffc commit ab4e754
File tree
2 files changed
+38
-7
lines changed- lib/Sema
- test/SILGen
2 files changed
+38
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1789 | 1789 | | |
1790 | 1790 | | |
1791 | 1791 | | |
1792 | | - | |
1793 | | - | |
1794 | 1792 | | |
1795 | 1793 | | |
1796 | 1794 | | |
1797 | 1795 | | |
1798 | 1796 | | |
| 1797 | + | |
| 1798 | + | |
1799 | 1799 | | |
1800 | 1800 | | |
1801 | 1801 | | |
1802 | 1802 | | |
1803 | 1803 | | |
1804 | 1804 | | |
1805 | | - | |
| 1805 | + | |
1806 | 1806 | | |
1807 | 1807 | | |
1808 | | - | |
| 1808 | + | |
1809 | 1809 | | |
1810 | 1810 | | |
1811 | 1811 | | |
| |||
1815 | 1815 | | |
1816 | 1816 | | |
1817 | 1817 | | |
1818 | | - | |
1819 | | - | |
| 1818 | + | |
1820 | 1819 | | |
1821 | | - | |
| 1820 | + | |
1822 | 1821 | | |
1823 | 1822 | | |
1824 | 1823 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments