Commit Graph

2046 Commits

Author SHA1 Message Date
Marco Pennekamp d6cb75ca91 [LL FIR] KT-55329 Support transitive dependsOn dependencies in LL FIR
- In contrast to other kinds of dependencies, `dependsOn` dependencies
  must be followed transitively.
- Add `transitiveDependsOnDependencies` to `KtModule`. These
  dependencies are calculated lazily with a topological sort. They are
  added to the dependency provider when it's built in
  `LLFirSessionFactory`.

^KT-55329 fixed
2023-01-30 17:17:58 +00:00
Marco Pennekamp 1803bd36cc [FIR] Fix IncDecOperatorsInExpectClass for FIR, add multi-module test
- `IncDecOperatorsInExpectClass.kt` should produce an
  `ACTUAL_WITHOUT_EXPECT` in K2 (see KT-55177). This went unnoticed
  because of KT-55570.
- A similar multi-module test for K1 and K2 has been added, called:
  `multiplatform/incDecOperatorsInExpectClass.kt`.
2023-01-30 17:17:57 +00:00
Marco Pennekamp 2faa247075 [FIR] KT-55570 Fix ACTUAL_WITHOUT_EXPECT reporting for empty classes
- FirExpectActualMatcherTransformer: Instead of returning,
  `transformMemberDeclaration` must assign an empty map to
  `expectForActualData` so that `FirExpectActualDeclarationChecker`
  doesn't assume that the member declaration needs no expect-actual
  checking.

^KT-55570 fixed
2023-01-30 17:17:57 +00:00
Marco Pennekamp 7c96124a38 [LL FIR] KT-55329 Rename refinementDependency to dependsOnDependency
- The new Kotlin MPP name for `refinementDependency` is
  `dependsOnDependency`.
2023-01-30 17:17:57 +00:00
Mikhail Glukhikh f6bd4d5e15 Diagnostic tests: create fieldRename subDir and use it for related tests
Related to: KT-55846, KT-50082, KT-55436, KT-55017
2023-01-30 14:55:40 +00:00
Roman Golyshev 5ec626b29d [Analysis API] KTIJ-24453 Handle TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM error in KtFe10CallResolver.kt
It makes call with such type of errors completely unresolvable in
Analysis API

^KTIJ-24453 Fixed
2023-01-30 12:45:19 +00:00
Marco Pennekamp 2f876a2094 [LL FIR] Pass correct session invalidators to LLFirSessionFactory 2023-01-30 12:39:42 +00:00
Yan Zhulanow fdf515baff [LL API] Add more logging to collectDesignationPathWithContainingClass() 2023-01-30 11:11:27 +00:00
Yan Zhulanow 699f96284a [FE] Add missing 'lazyResolveToPhase()' before recursive bound check
^KTIJ-24087 Fixed
2023-01-30 11:09:42 +00:00
Dmitriy Novozhilov 2fddb15539 [Test] Move some builder inference tests from codegen to diagnostics
^KT-56169
2023-01-30 09:29:58 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
Nikolay Lunyak e2403c801f [FIR] KT-55747: Report error for operator fun mod
^KT-55747 Fixed

Merge-request: KT-MR-8522
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-01-30 08:48:33 +00:00
Mikhail Glukhikh 8bc2aaa295 FE: Add test for KT-56227 (to confirm it's fixed) 2023-01-27 21:38:08 +00:00
Anna Kozlova e54627b309 [FIR] add missed diagnostics for incomplete code
^KT-55053
2023-01-27 18:36:36 +00:00
Roman Golyshev 71a368e06e [Analysis API] KTIJ-24107 Fix resolution of qualified invoke calls on objects
^KTIJ-24107 Fixed
^KTIJ-24344 Fixed
2023-01-27 16:49:30 +00:00
Roman Golyshev aab853ad12 [Analysis API] KTIJ-24107 Small cleanup in FirReferenceResolveHelper.kt 2023-01-27 16:49:29 +00:00
Anna Kozlova e5b96561e0 [FIR] skip implicit call to enum constructor if super type call exists
otherwise, reference to the super type would be resolved even when it's not
e.g. for interface constructor
^ KTIJ-24437
2023-01-27 08:20:07 +00:00
Mikhail Glukhikh d436d56871 FE: add some more tests around static field fake overrides 2023-01-26 15:27:58 +00:00
Mikhail Glukhikh 4167a69e30 K2: generate implicit dispatch receivers for static members called
#KT-55371 Fixed
#KT-55372 Fixed
2023-01-26 15:27:57 +00:00
Mikhail Glukhikh ead319f832 K2: add test for KT-55408 2023-01-26 15:27:56 +00:00
Kirill Rakhman 583584be7e FIR: Resolve error expression in initializer of FirField
^KT-54775 Fixed
2023-01-26 14:12:48 +00:00
pyos 8aa50e9446 FIR CFA: add edges from maybe-throwing statements to catch/finally 2023-01-26 09:50:24 +00:00
Marco Pennekamp 2922f85a98 [AA] KTIJ-23563 Add reference resolve tests for working cases
- Type arguments in invalid calls/property accesses are resolved
  correctly in many cases, for which this commit adds test cases.
2023-01-25 16:40:46 +00:00
Anna Kozlova b026678a34 [LL] retrieve fir from generated property of desugaring ++ operator
^ 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
2023-01-25 11:03:29 +00:00
Kirill Rakhman c1420794b4 FIR: add checker for local extension properties
^KT-56013 Fixed
2023-01-25 08:25:56 +00:00
Yan Zhulanow 9873fe84f2 [FE] Fix exception from the 'UnusedChecker' on a destructuring
^KT-55973 Fixed
2023-01-25 08:05:58 +00:00
Yan Zhulanow 84baee1ef1 [LL API] Fallback for designation path calculation for special cases
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).
2023-01-25 08:04:42 +00:00
Yan Zhulanow e390d2aae3 [LL API] Use a file as a modification tracker for out-of source roots 2023-01-25 08:04:42 +00:00
Yan Zhulanow 9619c695b7 [LL API] Support nested type aliases in file-based declaration provider 2023-01-25 08:04:41 +00:00
Yan Zhulanow 14178a9771 [LL API] Execute 'findNearClass()' only for stdlib-like classes
'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.
2023-01-25 08:04:41 +00:00
Yan Zhulanow 12e86bdb0c [LL API] Simplify 'withSyntheticClasses()', forbid nested on-air blocks 2023-01-25 08:04:41 +00:00
Yan Zhulanow 5120da6b70 [LL API] Rename 'outside' testPrefix with 'out_of_src_roots' 2023-01-25 08:04:40 +00:00
Yan Zhulanow 6ff3eb1a8d [LL API] Replace 'isLibrarySession' with an inverted extension function 2023-01-25 08:04:40 +00:00
Yan Zhulanow f6f667c387 [LL API] Adjust services required by LLFirBuiltinsSessionFactory
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'.
2023-01-25 08:04:40 +00:00
Yan Zhulanow f199671c4d [LL API] Make 'KtNotUnderContentRootModuleForTest' depend on built-ins 2023-01-25 08:04:39 +00:00
Yan Zhulanow 9bd1a24c13 [LL API] Add KDoc for 'KtNotUnderContentRootModule#file'. 2023-01-25 08:04:39 +00:00
Yan Zhulanow 562952080e [LL API] Add tests for 'FileBasedKotlinDeclarationProvider' 2023-01-25 08:04:39 +00:00
Yan Zhulanow 6ba3bcb6b2 [LL API] Support several class declarations with the same ClassId 2023-01-25 08:04:38 +00:00
Yan Zhulanow d442531987 [LL API] Use session of a callable container for designation computation
Synthetic callables might be created with a call-site session in which
the containing class might be not found.
2023-01-25 08:04:38 +00:00
Yan Zhulanow 4c22afd1f3 [LL API] Unify cache for 'not-under content root' modules
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.
2023-01-25 08:04:38 +00:00
Yan Zhulanow 7fb6fab517 Minor, remove unused code in 'compilerPluginConfiguration.kt' 2023-01-25 08:04:37 +00:00
Yan Zhulanow 10d6583d87 [LL API] Add fallback for cases when a containing class cannot be found
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()'.'
2023-01-25 08:04:37 +00:00
Yan Zhulanow e5cbe79027 [LL API] Encapsulate on-air class provider logic in LLFirProvider
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)
```
2023-01-25 08:04:36 +00:00
Yan Zhulanow f1edbc1a14 [LL API] Add tests for 'out of content root' analysis mode 2023-01-25 08:04:36 +00:00
Yan Zhulanow e4c2902e81 [LL API] Minor, clean up FirLowLevelCompilerBasedTestConfigurator 2023-01-25 08:04:36 +00:00
Yan Zhulanow e9af55fdee [LL API] Add PSI-based declaration provider for files outside roots
Indices are not available in the IDE for files outside content roots,
so a new provider acts as a single-file replacement.

^KTIJ-23937 Fixed
2023-01-25 08:04:36 +00:00
Yan Zhulanow 00a266fd88 [AAPI] Introduce PsiFile in KtNotUnderContentRootModule
Indices are not available in the IDE for files outside content roots,
and the newly introduced 'PsiFile' can be used for searching
classifiers instead.
2023-01-25 08:04:35 +00:00
Yan Zhulanow edacf27810 [LL API] Refactor designation path collection
Unify containing class chain resolution logic between callable
and class targets.
2023-01-25 08:04:35 +00:00
Nikolay Lunyak 9be819087a [FIR] KT-54410: Report API_NOT_AVAILABLE for classifiers
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
2023-01-25 07:14:19 +00:00
Anna Kozlova fd52cc4224 [AA] support qualified type in incomplete code
^ 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
2023-01-24 20:41:19 +00:00