Files
kotlin-fork/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/valWithNoNameInBlock.kt
T
Tianyu Geng fb14b03824 FIR checker: skip error named reference if receiver is unresolved
Currently, FIR reports errors caused by previous resolution failure. For
example with unresolved `a` and `b` in code `a.b`, both `a` and `b` are
highlighted. FE1.0 only highlights `a` since it's the root cause. This
change applies this heuristics when reporting FirDiagnostics.
2021-03-29 12:45:27 +03:00

52 lines
855 B
Kotlin
Vendored

// FIR_IDENTICAL
// !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<!>
}