This should make reference shortener considerably faster, since it won't
need to perform redundant extra resolve of the file.
`ContextCollector` more accurately collects the scopes for the scripts,
so some script tests are also fixed.
It should fix the following bugs:
^KTIJ-26714 Fixed
^KTIJ-26727 Fixed
This is also an important part of fixing the following bugs:
- KTIJ-26715
- KTIJ-26734
But those bugs also rely on KT-61890, because completion uses scopes
and snows incorrect elements from them
The idea of optimization is simple – delay in-block modification
until the end of a write action.
Q: Why the end of write action?
A: We have to publish the result of modification somewhere during
write action to be sure that the next read action will see the
updated result. We can't publish the result somewhere later
because we can't guarantee that the modification will be visible
to all customers.
In the case of out-of-block modification, we still have to publish
the result immediately because it is hard to evaluate the consequences
of the opposite decision yet.
If an out-of-block modification happens, we can drop all previous
in-block modifications from the queue because they don't make sense
due to invalidation of the entire KtModule.
A corner case is the analysis under write action. The delay means that
there is no longer any guarantee that all PSI changes will be reflected
into FIR tree immediately. So now we can guaranty only that at
the start of `analyze` block you will have the up-to-date FIR tree.
^KT-60611 Fixed
Prefer smaller inline functions, because otherwise if they become
hot spots, they will complicate performance analysis, and actually
might make everything slower because of low inlining threshold in
HotSpot.
- AnnotationDescriptor#argumentValue is not frontend-specific
- AnnotationDescriptor#getAnnotationStringValue is not Native-specific
We are going to need these functions in the IR code, so it makes
sense to factor them out to the core module.
Running the
`FirScriptCodegenTestGenerated.testSecondLevelFunction` test results
in "Expected is `FirResolvedDeclarationStatus`, but was
`FirDeclarationStatusImpl`. This is similar to the
`FirIdeNormalAnalysisSourceModuleCodeFragmentCollectDiagnosticsTestGenerated.testLocalFunction`
test, but that one was fixed by `9514f8f8`.
Looks like the situation here is the same,
it's just `FirScript` that needs to be
fixed.
The changed regarding the approximation is needed to avoid exposing
the anonymous type in
`FirScriptLazyDeclarationResolveTestGenerated.testDelegatesScript`.
The difference in the
`ScriptInBlockModificationTestGenerated.testRawContractScript`
test appeared because previously
the contract used to be
`FirRawContractDescription`, but
it now resolves to
`FirEmptyContractDescription`.
Assertion thrown in `check` was wrapped into something and ignored at
the call site, for some reason. So the "Looks like this test can be
unmuted..." error was never happening for this test.
In this commit we begin counting a catch parameter as
both a local variable and a value parameter for the purpose
of annotation targeting.
#KT-61691 Fixed
Normally such types are resolved during enhancement,
but creating the suspend view happens before
enhancement, so the type may have not been resolved.
^KT-59915 Fixed