Commit d78bf22
committed
[CodeCompletion] Fix crashes in TypeCheckASTNodeAtLocRequest
receive {
switch <HERE>
}
In the current Parser implementation, if there's a error in 'switch'
subject, the 'SwitchStmt' is not placed in the parsed AST.
When the type checker searches AST node at the location, it used to find
'receive { ... }' because that is the *innermost* node in the AST that
contains the loc. But the decl context is the closure. This behavior used
to cause crashes because 'receive { ... }' is re-typechecked.
For solution, when finding the innermost AST node, clear the found node
in parent context before walking into brace statement.
rdar://problem/692468911 parent 147015d commit d78bf22
File tree
2 files changed
+23
-2
lines changed- lib/Sema
- validation-test/IDE/crashers_2_fixed
2 files changed
+23
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1841 | 1841 | | |
1842 | 1842 | | |
1843 | 1843 | | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
1844 | 1854 | | |
1845 | 1855 | | |
1846 | 1856 | | |
1847 | 1857 | | |
1848 | 1858 | | |
1849 | | - | |
| 1859 | + | |
| 1860 | + | |
1850 | 1861 | | |
1851 | 1862 | | |
1852 | 1863 | | |
| |||
1858 | 1869 | | |
1859 | 1870 | | |
1860 | 1871 | | |
1861 | | - | |
1862 | 1872 | | |
| 1873 | + | |
| 1874 | + | |
1863 | 1875 | | |
1864 | 1876 | | |
1865 | 1877 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments