72def186a3
The change is needed for the parallel resolution (^KT-55750), so we can resolve the declaration under a lock that is specific to this declaration. Previously, if LL FIR was resolving some FirClass, LL FIR resolved all its children too, and it had no control over what parts of the FIR tree were modified. The same applied to the designation path, sometimes the classes on the designation path might be unexpectedly (and without lock) modified. This commit introduces LLFirResolveTarget, which specifies which exact declarations should be resolved during the lazy resolution of the declaration. All elements outside the declarations specified for resolve in LLFirResolveTarget, should not be modified. The logic of lazy transformers is the following: - Go to target declaration collecting all scopes from the file and containing classes - Resolve only declarations that are specified by the LLFirResolveTarget, performing the resolve under a separate lock for each declaration ^KT-56543 ^KT-57619 Fixed
33 lines
839 B
Kotlin
Vendored
33 lines
839 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
|
package o
|
|
|
|
class TestFunctionLiteral {
|
|
val sum: (Int) -> Int = { x: Int ->
|
|
<!UNINITIALIZED_VARIABLE!>sum<!>(x - 1) + x
|
|
}
|
|
val foo: () -> Unit = l@ ({ <!UNINITIALIZED_VARIABLE!>foo<!>() })
|
|
}
|
|
|
|
open class A(val a: A)
|
|
|
|
class TestObjectLiteral {
|
|
val obj: A = object: A(<!UNINITIALIZED_VARIABLE!>obj<!>) {
|
|
init {
|
|
val x = <!UNINITIALIZED_VARIABLE!>obj<!>
|
|
}
|
|
fun foo() {
|
|
val y = <!UNINITIALIZED_VARIABLE!>obj<!>
|
|
}
|
|
}
|
|
val obj1: A = <!REDUNDANT_LABEL_WARNING!>l@<!> ( object: A(<!UNINITIALIZED_VARIABLE!>obj1<!>) {
|
|
init {
|
|
val x = <!UNINITIALIZED_VARIABLE!>obj1<!>
|
|
}
|
|
fun foo() = <!UNINITIALIZED_VARIABLE!>obj1<!>
|
|
})
|
|
}
|
|
|
|
class TestOther {
|
|
val x: Int = <!UNINITIALIZED_VARIABLE!>x<!> + 1
|
|
}
|