Implement recovery for incomplete expression before declaration

It's needed when declarations are parsed as a part of previous expression
(see tests)

Currently we apply this kind of recovery in a conservative way,
only when declaration starts at the next line, and while
the condition could be relaxed, there's no need to do this

 #KT-4948 Fixed
 #KT-7118 Fixed
This commit is contained in:
Denis Zharkov
2016-07-13 18:32:47 +03:00
parent 06a659e6e7
commit 4725dd3028
14 changed files with 623 additions and 30 deletions
@@ -1,4 +1,4 @@
fun foo(s: String) {
s.
<!DECLARATION_IN_ILLEGAL_CONTEXT, ILLEGAL_SELECTOR!>val b = 42<!>
}
s.<!SYNTAX!><!>
val <!UNUSED_VARIABLE!>b<!> = 42
}