In details, this commit changes the following:
- it converts FIR when without branches to empty IR block without when
- it doesn't drop empty else branches in when anymore
^ KTIJ-24385
Temp property to store receiver is generated for `a.b++` expression.
If this property's psi corresponds to receiver expr, then FirProperty
would be found by mapper if receiver is requested.
It works unexpectedly, because FirProperty is normally not expected by expression.
This change set fake sources for generated FirProperty, so it won't be found
by source psi
Currently, designation path requires all intermediate classes to be
regular named classes. This is not certainly possible, especially for
invalid cases such as:
---
class Foo {
object {
class Bar {
fun foo() {} // What's the designation path for 'foo()'?
}
}
}
---
If there was a way to get a parent for a given FIR element, we could
just follow parents until the root FIR node (which would be a FirFile).
'LLFirProvider'/'LLFirProviderHelper' do not normally search for classes
in the 'kotlin.' package. While it has a positive impact on performance,
as 'kotlin.' package is normally forbidden in arbitrary modules,
during designation path calculation we need to handle also invalid
cases.
As 'initialiseVirtualFileFinderServices()' that is run during
test initialization collects transitive dependencies, all of them
must be ready. However, 'KtNotUnderContentRootModuleForTest' has a
built-in dependency provided by 'LLFirBuiltinsSessionFactory'.
Before, 'FirSession's for not-under content root modules were stored in
a project-global service, which essentially means that even if one
creates a non-cached 'LLFirResolveSession', 'FirSession's for such
modules will be cached and reused later. Such exact behavior happened in
sealed class inheritor pre-analysis handler.
In some cases, 'LLFirProvider' doesn't return the existing class, e.g.
when the class is inside the 'kotlin.' package but when the
'-Xallow-kotlin-package' flag is not passed.
This fixes the test 'DiagnosisCompilerTestFE10TestdataTestGenerated.
TestsWithStdLib.testInaccessibleInternalClass()'.'
The old 'FirProviderInterceptor' is too invasive, ad-hoc, and only a
few places in the compiler are aware of it.
This fixes the test 'FirOnAirResolveTestGenerated#testOnAirTypesResolve'
which started failing after the designation path collection refactoring.
The newly appeared class existence check started to fail:
```
val declaration = firProvider.getFirClassifierByFqName(classId)
check(declaration != null)
```
Indices are not available in the IDE for files outside content roots,
and the newly introduced 'PsiFile' can be used for searching
classifiers instead.
`INVISIBLE_REFERENCE` may be reported due to CandidateApplicability via
a ConeDiagnostic, or in a checker. The former leads to
`FirErrorResolvedQualifier`, so the checker is not called.
This makes little sense, because CandidateApplicability may result in
`NO_COMPANION_OBJECT`, which would prevent other more meaningful
diagnostics from being reported (like `API_NOT_AVAILABLE`).
If we run checkers for `FirErrorResolvedQualifier` we may get duplicate
`INVISIBLE_REFERENCE`. The change in the checker prevents it.
Callable symbols with SinceKotlin are filtered out by a
resolution stage, but in K1 classifiers and property accessors
report API_NOT_AVAILABLE. K2 filters out properties with
unavailable accessors, but does nothing for classifiers.
This change fixes it.
^KT-54410 Fixed
^ KTIJ-24373
when resolving selector expr of a dot qualified expression,
parent qualified expression is resolved
see `KtFirCallResolver.getContainingDotQualifiedExpressionForSelectorExpression`,
Fir is filled with the data. Then,
during final mapping from Fir -> psi, one need to perform the opposite:
take `selectionExpression` to get the initial KtCallExpression
It's done by hardcoding the task classes unlike to approach with other build services (with adding interfaces like Uses<blah-blah-service>), because the J/S services are subject to rework in a short time. This way earlier task initialization shouldn't cause problems.
#KT-56131 Fixed