Commit Graph

108902 Commits

Author SHA1 Message Date
Dmitriy Dolovov f9f97f2050 [KLIB tool] Support metadata format by kotlinp
Use the unified metadata printing format in KLIB tool. The same format
is already used in `kotlinp` CLI tool.

^KT-62340
2024-02-15 15:38:27 +00:00
Dmitriy Dolovov 83cc0d75a7 [kotlinp] Support rendering KLIB metadata using "kotlinp" format
This commit includes:
1. New subproject :tools:kotlinp-klib that contains the facade for
   rendering the metadata in "kotlinp" format given just
   KlibModuleMetadata
2. A tool for computing (external) IR signatures that are not directly
   available in metadata: KlibKotlinpExternalSignatureComputer

^KT-62340
2024-02-15 15:38:27 +00:00
Leonid Startsev ed30221f42 Publish kotlin-metadata-jvm as a part of Kotlin distribution
and add a corresponding POM test.

#KT-63161 Fixed
2024-02-15 15:32:33 +00:00
Leonid Startsev 09e89db82f Change kotlinx- to kotlin- in kotlin-metadata-jvm and related projects
Change package, artifact group, artifact name, and Gradle module name to
kotlin-metadata and kotlin-metadata-jvm, respectively.

In Kotlin 2.0, kotlin-metadata-jvm library is promoted to stable, and is
a part of Kotlin distribution now.

Note that kotlinx-metadata-klib is left with org.jetbrains.kotlinx group, artifact name and package
because -klib part is considered not stable and for internal use. Since it is still published via Sonatype,
it should have kotlinx group. Therefore, it will have both classes from kotlin.metadata and kotlinx.metadata packages. This is not a problem, because we already had kotlinx.metadata split package between -jvm and -klib before.

#KT-63219 Fixed
2024-02-15 15:32:33 +00:00
Dmitrii Gridin c78d3edd24 [SLC] support type parameter annotations
^KT-65112 Fixed
2024-02-15 15:18:02 +00:00
Dmitrii Gridin ae8e9749c8 [SLC] AnnotationsBox: use PsiElement instead of PsiModifierList
Not only PsiModifierList can be the parent of an annotation,
so we should make the restrictions less aggressive.

^KT-65112
2024-02-15 15:18:02 +00:00
Dmitrii Gridin 717dd08fd4 [LC] PsiClassRenderer: render type parameter annotations
^KT-65112
2024-02-15 15:18:02 +00:00
Dmitrii Gridin 3e3c932bf6 [LC] add tests on type parameter annotations
^KT-65112
2024-02-15 15:18:02 +00:00
Dmitrii Gridin d5705af8b1 [SLC] AbstractSymbolLightClassesParentingTestBase: make aware of PsiTypeParameter
It can have annotations

^KT-65112
^IDEA-346155
2024-02-15 15:18:02 +00:00
Yahor Berdnikau 4971af293c [Gradle] Remove ownModuleName input
^KT-64504 Verification Pending
2024-02-15 15:02:51 +00:00
Stanislav Ruban 9fb920874c [tests] Add additional test data for KT-64222 2024-02-15 13:22:23 +00:00
Dmitriy Novozhilov b87aa470dd [Test] Ensure FIR doesn't fail on recursive private-to-this case
^KT-55446
2024-02-15 13:08:36 +00:00
Dmitriy Novozhilov c64575f4a2 [FIR] Move check for _private-to-this_ visibility into checker
^KT-55446
^KT-65790 Fixed
2024-02-15 13:08:35 +00:00
Dmitriy Novozhilov 5fe1e0c1a5 [FIR] Allow nullable type arguments in diagnostic reporting utilities
Commit cceb7197 removed restriction of non-nullability of diagnostic
  arguments, but corresponding utilities were not updated
2024-02-15 13:08:35 +00:00
Kirill Rakhman 81e0abeb8f [FIR] Fix mapped constructor hiding logic
Partially reverts 24367e0ad8

Constructors have their own list of hidden/visible.
We now require the constructor to be in VISIBLE_CONSTRUCTOR_SIGNATURES,
everything else is hidden.
This makes it unnecessary to check HIDDEN_CONSTRUCTOR_SIGNATURES

#KT-65821 Fixed
2024-02-15 13:08:15 +00:00
Dmitriy Novozhilov 84f0f6e099 [FIR] Resolve statuses of supertypes for all non-source classes
Previously we forced computation only for java and precompiled classes,
  assuming, that binary class can not extend source class, but it's not
  true in two cases:
1. Classpath substitution: class with same name declared in library and
   the source (more rare case)
2. Metadata compilation: depends-on dependcies are passed in binary
   format, so `expect class` may be a binary one and corresponding
   `actual class` may be a source. So if some class in `common` module
   extend this expect class, actual class will be substituted instead of it

^KT-65669 Fixed
2024-02-15 12:18:48 +00:00
Dmitriy Dolovov 9219a8f485 [FIR] Expand type of vararg parameter before constructing array type
This helps to have a primitive array instead of an array of primitives
as the type of vararg value parameter. Also, this prevents
ABI-incompatibility with the libraries (KLIBs) compiled with K1.

^KT-65588
2024-02-15 11:55:32 +00:00
Dmitrii Gridin 3962f26583 [FIR] PsiRawFirBuilder: drop obsolete LL FIR parts 2024-02-15 10:50:47 +00:00
Dmitrii Gridin 58a1662c02 [LL FIR] FirLazyBodiesCalculator: drop obsolete logic for compiler required annotations
We have custom logic on `LLFirCompilerRequiredAnnotationsTargetResolver`
side
2024-02-15 10:50:47 +00:00
Dmitrii Gridin f5f3b7fec0 [LL FIR] drop unused declarations 2024-02-15 10:50:47 +00:00
Dmitrii Gridin 8f83e2ab4d [LL FIR] drop RawFirUserTypeRefBuilder as obsolete 2024-02-15 10:50:47 +00:00
Dmitrii Gridin c1205bfba9 [LL FIR] drop RawFirFileAnnotationBuilder as obsolete 2024-02-15 10:50:47 +00:00
Dmitrii Gridin fd74de6ccf [LL FIR] drop RawFirReplacement as obsolete 2024-02-15 10:50:47 +00:00
Dmitrii Gridin ba947fbf04 [LL FIR] RawFirNonLocalDeclarationBuilder: drop redundant functions
They are obsolete as we dropped on-air resolution logic
2024-02-15 10:50:47 +00:00
Kirill Rakhman 33648e1f44 [FIR] Unwrap vararg array types for diagnostic rendering
#KT-65770 Fixed
2024-02-15 10:48:56 +00:00
Kirill Rakhman eae72eac54 [FIR] Fix substitution of Java arrays enhanced for warning
... w.r.t the variance of their type arguments.
Because `Object[]` is represented as `Array<Any>..Array<out Any>?`,
when we substitute, we can't just take the upper bound because it
changes the variance of the type agument.
Instead, we construct a flexible type and use both bounds, like with
collections with flexible mutability.

#KT-65246 Fixed
2024-02-15 10:48:56 +00:00
Vladimir Sukharev 20f6b0cb0c [K/N][Tests] Migrate test ir_providers_mismatch
^KT-61259
2024-02-15 10:13:56 +00:00
Alexander Udalov 88fbaed22e Tests: minor, do not use target backend in kapt tests
These tests now only make sense for JVM_IR. Incidentally this fixes the
JVM illegal access warnings from generateTests, because the test
framework no longer tries to instantiate these tests (which leads to
`doOpenInternalPackagesIfRequired`) to determine the target backend.

The change in JvmEnvironmentConfigurator is needed so that JVM tests
without target backend would default to JVM IR instead of the old
backend.

Also rename files to match the class names.
2024-02-15 10:13:24 +00:00
Kirill Rakhman 879cdd5952 [FIR] Fix flattening of substitution overrides of intersection overrides for subsumed check
#KT-65555 Fixed
2024-02-15 08:43:06 +00:00
Roman Efremov 3994e3f63a [FIR] Deprecate using typealias as callable qualifier in import
^KT-64350 Fixed
2024-02-15 08:37:02 +00:00
Kirill Rakhman 802366064d [FIR] Expand annotation types in annotation serialization
#KT-65659 Fixed
2024-02-15 08:27:44 +00:00
Vladimir Sukharev 243d6aed50 [K/N][Tests] Add test for KT-65659
^KT-65659
2024-02-15 08:27:44 +00:00
Nataliya.Valtman 090407b7e3 Add compiler IRMeasurement to build reports
#KT-65091: Fixed
2024-02-15 07:51:51 +00:00
Anna Kozlova b4b1c7cd69 [PSI] avoid loading KtFile class during parsing of chameleons
^KTIJ-28801 fixed
2024-02-15 07:17:26 +00:00
Ilya Kirillov d925d3be76 [Analysis API] Fix Unexpected FirClassLikeSymbol null for class org.jetbrains.kotlin.fir.types.ConeClassLikeErrorLookupTag exception
on calling `asPsiType` on an unresolved type with type arguments

 ^KT-65550 fixed
2024-02-15 06:38:47 +00:00
Ilya Kirillov 50d526fe91 [Analysis API] Check all possible combinations of arguments in tests for KtType.asPsiType() 2024-02-15 06:38:47 +00:00
Vladimir Sukharev bf0150108d [K/N][Tests] Move filecheck and cinterop tests to /native/
^KT-61259
2024-02-14 23:36:34 +00:00
Dmitriy Dolovov 05cbe66ee0 [FIR][tests] Unify IntArrayAsVararg.kt test between K1 and K2
Rename `main` function to `test` to avoid running JVM-specific mangling
and having different IR signature dumps for K1 and K2.

^KT-65588
2024-02-14 23:00:04 +00:00
Alexander Udalov 41ef3da5ff Tests: add regression test for KT-63448 2024-02-14 21:44:42 +00:00
Alexander Shabalin 72e30a3d26 [K/N][tests] :native:native.tests:test requires platform libs 2024-02-14 20:25:43 +00:00
Dmitrii Krasnov 70a887e3ba [Gradle IT] Separated adding repositories block and dependencyManagement
In Gradle, there is a bug that leads to race condition,
when we use ivy repo in the settings file.
This bug was solved only in 8.1,
 so we supported dependencyManagement in our IT only since 8.1.
 For Gradle less 8.1 we just add the same repos to build script.

 ^KT-65708 Fixed
2024-02-14 20:02:25 +00:00
cristiangarcia 85399bc969 Fake service to limit tests concurrency
Required for KTI-1553
2024-02-14 18:35:43 +00:00
Dmitrii Gridin 46d16dfb6c [LL FIR] PersistenceContextCollector: change designation path resolution order
We will process more specific declaration firstly to avoid contention.
As the next step of addbb713a5

^KT-65780
2024-02-14 17:53:31 +00:00
Dmitrii Gridin 78c394d4de [LL FIR] FirElementBuilder: search file header elements without body resolution
^KT-65780
2024-02-14 17:53:31 +00:00
Dmitrii Gridin 04a2d6b616 [LL FIR] FirElementBuilder: make getFirForNonBodyElement more abstract
This is required for the next step

^KT-65780
2024-02-14 17:53:31 +00:00
Dmitrii Gridin 38a3010ac8 [LL FIR] FirElementBuilder: search file annotations without body resolution
^KT-65780
2024-02-14 17:53:31 +00:00
Dmitrii Gridin cca58f5c2a [LL FIR] FirElementBuilder: accept KtAnnotated instead of KtDeclaration as annotation owner
^KT-65780
2024-02-14 17:53:31 +00:00
Dmitrii Gridin 7796ef43db [LL FIR] FileStructure: resolve FirFile to body phase as all other elements
This is the correct behavior as we have to resolve to body phase
to build CFG and run diagnostics collector correctly

^KT-65780 Fixed
2024-02-14 17:53:31 +00:00
Dmitrii Gridin 84b6d5d508 [LL FIR] add tests for getOrBuildFir for KtFileAnnotationList
^KT-65780
2024-02-14 17:53:31 +00:00
Dmitrii Gridin 5426cbc3df [LL FIR] tests for this with annotations as implicit return type
^KT-61175
^KT-64215
2024-02-14 17:46:47 +00:00