Commit Graph

98099 Commits

Author SHA1 Message Date
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
Sergey Bogolepov 7cc2947c57 [K/N] Fix KT-56132
Add a secondary constructor for compatibility purposes
2023-01-25 07:21:19 +00:00
Nikolay Lunyak e187c9272d [FIR] Run checkers for FirErrorResolvedQualifier
`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.
2023-01-25 07:14:19 +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
Alexander.Likhachev 92d39f0b1d [Gradle] Inverse K/JS build services declaration
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
2023-01-24 19:15:59 +00:00
Alexander.Likhachev 7638b95a31 [Gradle] Add integration tests for KT-56131 2023-01-24 19:15:58 +00:00
Sebastian Sellmair 6d660451b5 [Gradle] LazyResolvedConfiguration: Ensure lenient resolution of artifacts
^KT-56153 Verification Pending
2023-01-24 18:52:40 +00:00
Jinseong Jeon fc2da32eb6 [references] introduce a dummy reference resolve helper
...because the implementation of reference resolution helper in IDE is
not always available (e.g., Android Lint CLI).
2023-01-24 17:54:00 +01:00
Egor Kulikov a24593da04 [FIR] Make annotations arguments lazy in RawFirBuilder
Process compiler annotations on all top level declarations
2023-01-24 16:02:55 +00:00
Egor Kulikov c5f13c5e7a [FIR] Make annotations arguments lazy in RawFirBuilder
Add more tests with annotations with arguments
2023-01-24 16:02:54 +00:00
Egor Kulikov ce262b0fb8 [FIR] Make annotations arguments lazy in RawFirBuilder
Fix style and typo
2023-01-24 16:02:54 +00:00
Egor Kulikov 195ecad004 [FIR] Make annotations arguments lazy in RawFirBuilder
Sixth step for ^KT-52615
2023-01-24 16:02:53 +00:00
Sebastian Sellmair f15feb644b [Gradle] Ensure cinterop* configurations contain target/compilation attributes
^KT-56115 Verification Pending
2023-01-24 15:53:30 +00:00
Ivan Kochurkin bf145ddee8 Extract common buildKotlinMetadataLibrary
Use it in FirMetadataSerializer and K2MetadataKlibSerializer
2023-01-24 15:27:15 +00:00
Ivan Kochurkin 1dde34b610 Extract common AbstractMetadataSerializer
With inheritors: MetadataSerializer, K2MetadataKlibSerializer, FirMetadataSerializer
2023-01-24 15:27:14 +00:00
Ivan Kochurkin 8a8823e81a Extract CommonAnalysisResult and use it in K2MetadataKlibSerializer and MetadataSerializer 2023-01-24 15:27:14 +00:00
Ivan Kochurkin 44b7859356 [FIR] Implement FIR metadata serialization
Add FirMetadataSerializer

Add CLI metadata tests on FIR
2023-01-24 15:27:14 +00:00
Ivan Kochurkin 46b9e15101 [FIR] Rename firMultiplatformCompilationWithLightTreeWithoutErrors
to firMultiplatformCompilationWithPsiWithoutErrors

Use `-Xuse-fir-lt=false` since now lt is default
2023-01-24 15:27:13 +00:00
Ivan Kochurkin 04fc2bde96 [FIR] Extract resolveAndCheckFir to firUtils
Use it in compilerPipeline and FirKotlinToJvmBytecodeCompiler
2023-01-24 15:27:13 +00:00
Ivan Kochurkin 5f1ed56554 [FIR] Extract createFirLibraryListAndSession to cliCompilerUtils
Use it in compilerPipeline and FirKotlinToJvmBytecodeCompiler
2023-01-24 15:27:13 +00:00
Ivan Kochurkin 1edc9f0a1d [FIR] Introduce FirCommonSessionFactory 2023-01-24 15:27:12 +00:00
Ivan Kochurkin e22359cc10 [FIR] Add MetadataSymbolProvider
Extract common code from K1 to MetadataUtil
2023-01-24 15:27:12 +00:00
Ivan Kochurkin c103da98dd [FIR] Add missing dependencies to :compiler:fir:checkers:checkers.native 2023-01-24 15:27:12 +00:00
Ivan Kochurkin 3f68694b0f Move MetadataPartProvider to deserialization.common
To make it possible to use it in FIR compiler
2023-01-24 15:27:11 +00:00
Sergey Bogolepov 60900b72b7 [K/N] Fix compilation of metadata klibs 2023-01-24 15:26:06 +00:00
Svyatoslav Kuzmich 983140ca04 [Wasm] stdlib NFC: suppress unchecked cast 2023-01-24 16:02:48 +01:00
Sebastian Sellmair c5d929eee4 [Gradle] Update MppCInteropDependencyTransformationIT UP-TO-DATE requirements
KT-56115
2023-01-24 14:47:28 +00:00
Sebastian Sellmair 103fb39306 [Gradle] CInteropMetadataDependencyTransformationTask: Ignore project dependencies
Included builds will still resolve using a regular
ArtifactMetadataProvider (but using a ProjectComponentIdentifier).

Such dependencies shall not try to go through cinterop metadata
transformation. Right now commonized dependencies from
included builds will just not be visible/exported to the
consumer builds.

Using cinterop declarations inside the API surface will
not be enabled until more stability guarantees for cinterops can
be provided

^KT-56115 Verification Pending
2023-01-24 14:47:28 +00:00
Sebastian Sellmair d94a9411e0 [Gradle] MppCompositeBuildIT: Run also with cinterop commonization enabled
KT-56115
2023-01-24 14:47:28 +00:00
Svyatoslav Kuzmich feca26e481 [Wasm] stdlib NFC: remove experimentalPackageStub.kt
Common sources now include `kotlin.experimental` and this file is no longer needed.
2023-01-24 14:55:00 +01:00
Svyatoslav Kuzmich e1f72d60dc [Wasm] stdlib API: Mark primitives constructor properties as private
These are implementation detail and were not meant to be public
2023-01-24 14:55:00 +01:00
Svyatoslav Kuzmich 354b231ea2 [Wasm] stdlib API: Mark internal compareTo functions as internal
Default public visibility was a mistake.
They were not intended to be public.
2023-01-24 14:54:59 +01:00