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:
+29
@@ -0,0 +1,29 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
fun foo(x: Any) {
|
||||
x.<!SYNTAX!><!>
|
||||
val foo = 1
|
||||
|
||||
x.<!SYNTAX!><!>
|
||||
fun bar() = 2
|
||||
|
||||
x.
|
||||
<!ILLEGAL_SELECTOR!>fun String.() = 3<!>
|
||||
|
||||
var a = 24.<!SYNTAX!><!>
|
||||
var b = 42.0
|
||||
}
|
||||
|
||||
class A {
|
||||
val z = "a".<!SYNTAX!><!>
|
||||
val x = 4
|
||||
|
||||
val y = "b".<!SYNTAX!><!>
|
||||
fun baz() = 5
|
||||
|
||||
val q = "c".
|
||||
<!ILLEGAL_SELECTOR!>fun String.() = 6<!>
|
||||
|
||||
var a = 24.<!SYNTAX!><!>
|
||||
var b = 42.0
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public final var a: [ERROR : Type for 24.]
|
||||
public final var b: kotlin.Double
|
||||
public final val q: [ERROR : Type for "c".
|
||||
fun String.() = 6]
|
||||
public final val x: kotlin.Int = 4
|
||||
public final val y: [ERROR : Type for "b".]
|
||||
public final val z: [ERROR : Type for "a".]
|
||||
public final fun baz(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
fun foo(x: Any?) {
|
||||
x ?:<!SYNTAX!><!>
|
||||
val foo = 1
|
||||
|
||||
x ?:<!SYNTAX!><!>
|
||||
fun bar() = 2
|
||||
|
||||
val res: String.() -> Int = null ?:
|
||||
fun String.() = 3
|
||||
}
|
||||
|
||||
class A {
|
||||
val z = null ?:<!SYNTAX!><!>
|
||||
val x = 4
|
||||
|
||||
val y = null ?:<!SYNTAX!><!>
|
||||
fun baz() = 5
|
||||
|
||||
val q = null ?:
|
||||
fun String.() = 6
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ x: kotlin.Any?): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public final val q: kotlin.String.() -> kotlin.Int
|
||||
public final val x: kotlin.Int = 4
|
||||
public final val y: [ERROR : Type for null ?:]
|
||||
public final val z: [ERROR : Type for null ?:]
|
||||
public final fun baz(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user