[LL] Add PSI resilience tests for LLFirDeclarationModificationService

- The cause of KT-63130 is that `LLFirDeclarationModificationService`
  tries to analyze inconsistent PSI. These new tests replicate the
  inconsistent PSI by deleting different children and then call the
  declaration modification service with it, making sure that the service
  doesn't throw any exceptions. Both exceptions mentioned in the issue
  are reproduced by the added tests, specifically, the receiver and
  selector resilience tests for dot-qualified expressions.
- A few of the tests need to be marked with `IGNORE_FIR` until the error
  has been fixed in the subsequent commit.

^KT-63130
This commit is contained in:
Marco Pennekamp
2023-11-13 18:56:06 +01:00
committed by Space Team
parent 12b6096b67
commit 6c67835128
13 changed files with 330 additions and 0 deletions
@@ -0,0 +1,10 @@
import kotlin.contracts.contract
import kotlin.contracts.InvocationKind
inline fun foo(block: () -> Unit) {
<expr>contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}</expr>
block()
}
@@ -0,0 +1,3 @@
fun foo(string: String) {
<expr>println("Hello world, $string!")</expr>
}
@@ -0,0 +1,4 @@
fun foo(string: String) {
val a = 7
<expr>println("Hello world, $string!")</expr>
}
@@ -0,0 +1,11 @@
// IGNORE_FIR
import kotlin.contracts.InvocationKind
inline fun foo(block: () -> Unit) {
<expr>kotlin.contracts.contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}</expr>
block()
}
@@ -0,0 +1,5 @@
// IGNORE_FIR
fun foo(string: String) {
<expr>string.length</expr>
}
@@ -0,0 +1,4 @@
fun foo(string: String) {
println()
<expr>string.length</expr>
}
@@ -0,0 +1 @@
<expr>val property: Int = 5</expr>