Commit e7f5ca9
committed
[Sema] Better handle recovery for structurally invalid ReturnStmts
Make sure we preserve the result expression for an out-of-place
`return`, or a non-`nil` result in an initializer. This ensures we
can still provide semantic functionality from them and fixes a crash
where we would fail to type-check a binding.1 parent ea79f67 commit e7f5ca9
File tree
4 files changed
+42
-11
lines changed- lib/Sema
- test
- IDE
- stmt
- validation-test/compiler_crashers_fixed
4 files changed
+42
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1091 | 1091 | | |
1092 | 1092 | | |
1093 | 1093 | | |
| 1094 | + | |
| 1095 | + | |
1094 | 1096 | | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
1098 | 1100 | | |
1099 | | - | |
| 1101 | + | |
1100 | 1102 | | |
1101 | 1103 | | |
1102 | 1104 | | |
| |||
1785 | 1787 | | |
1786 | 1788 | | |
1787 | 1789 | | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
1788 | 1805 | | |
1789 | 1806 | | |
1790 | 1807 | | |
1791 | | - | |
| 1808 | + | |
1792 | 1809 | | |
1793 | 1810 | | |
1794 | 1811 | | |
1795 | 1812 | | |
1796 | 1813 | | |
1797 | | - | |
| 1814 | + | |
1798 | 1815 | | |
1799 | 1816 | | |
1800 | 1817 | | |
| |||
1815 | 1832 | | |
1816 | 1833 | | |
1817 | 1834 | | |
1818 | | - | |
1819 | | - | |
| 1835 | + | |
1820 | 1836 | | |
1821 | 1837 | | |
1822 | 1838 | | |
| |||
1826 | 1842 | | |
1827 | 1843 | | |
1828 | 1844 | | |
1829 | | - | |
1830 | | - | |
| 1845 | + | |
1831 | 1846 | | |
1832 | 1847 | | |
1833 | 1848 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
0 commit comments