mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
If property name is parsed on the next line and declaration is invalid (no receiver/type/initializer), treat that name as it does not belong to property #KT-12987 In Progress
51 lines
838 B
Kotlin
Vendored
51 lines
838 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
|
|
|
fun println(x: String) {
|
|
}
|
|
|
|
fun run(block: () -> Unit) {}
|
|
|
|
val propertyNameOnTheNextLine = 1
|
|
|
|
fun foo() {
|
|
val<!SYNTAX!><!>
|
|
println("abc")
|
|
|
|
val<!SYNTAX!><!>
|
|
run {
|
|
println("abc")
|
|
}
|
|
|
|
val<!SYNTAX!><!>
|
|
if (1 == 1) {
|
|
|
|
}
|
|
|
|
val<!SYNTAX!><!>
|
|
(1 + 2)
|
|
|
|
// `propertyNameOnTheNextLine` parsed as simple name expression
|
|
val<!SYNTAX!><!>
|
|
propertyNameOnTheNextLine
|
|
|
|
val<!SYNTAX!><!>
|
|
// comment
|
|
propertyNameOnTheNextLine
|
|
|
|
val<!SYNTAX!><!> /* comment */
|
|
propertyNameOnTheNextLine
|
|
|
|
// Correct properties
|
|
val
|
|
property1 = 1
|
|
|
|
val
|
|
propertyWithBy by <!UNRESOLVED_REFERENCE!>lazy<!> { 1 }
|
|
|
|
val
|
|
propertyWithType: Int
|
|
|
|
val
|
|
(a, b) = <!COMPONENT_FUNCTION_MISSING, COMPONENT_FUNCTION_MISSING!>1<!>
|
|
}
|