[AA] Fix write access configuration in unit test application environments

- We cannot configure the application's write action accessibility on a
  per-test basis because (1) the application may be shared across
  concurrent tests and (2) the application is usually cached, so the
  configuration will be missed entirely.
- There is actually a much easier solution to allow write access
  selectively: We can enable it in `runWriteAction` blocks, and keep it
  in a thread local to support concurrent test runs. As Analysis API
  tests never call `runWriteAction`, there will be no "analyze cannot be
  called from a write action" error, and if `analyze` is somehow called
  from a write action, it will now be caught.

^KT-63560 fixed
This commit is contained in:
Marco Pennekamp
2023-11-17 17:57:13 +01:00
committed by Space Team
parent 3b7f43a9c2
commit 1870189e47
13 changed files with 42 additions and 62 deletions
@@ -1,6 +1,3 @@
// IGNORE_FIR
// Reason: KT-63560
import kotlin.contracts.contract
import kotlin.contracts.InvocationKind
@@ -1,6 +1,3 @@
// IGNORE_FIR
// Reason: KT-63560
fun foo(string: String) {
<expr>println("Hello world, $string!")</expr>
}
@@ -1,6 +1,3 @@
// IGNORE_FIR
// Reason: KT-63560
fun foo(string: String) {
val a = 7
<expr>println("Hello world, $string!")</expr>
@@ -1,6 +1,3 @@
// IGNORE_FIR
// Reason: KT-63560
import kotlin.contracts.InvocationKind
inline fun foo(block: () -> Unit) {
@@ -1,6 +1,3 @@
// IGNORE_FIR
// Reason: KT-63560
fun foo(string: String) {
<expr>string.length</expr>
}
@@ -1,6 +1,3 @@
// IGNORE_FIR
// Reason: KT-63560
fun foo(string: String) {
println()
<expr>string.length</expr>
@@ -1,4 +1 @@
// IGNORE_FIR
// Reason: KT-63560
<expr>val property: Int = 5</expr>