- 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
- The exceptions in KT-63130 occur because PSI tree change events may be
published when parts of the PSI under modification are inconsistent.
Such inconsistent elements are then analyzed by
`LLFirDeclarationModificationService` to check if the modification
occurs in a contract statement.
- The solution adds `*OrNull` functions to `KtQualifiedExpression` which
return `null` instead of failing with an exception when the receiver
or selector cannot be found.
^KT-63130 fixed
- 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