Commit Graph

109329 Commits

Author SHA1 Message Date
Pavel Kunyavskiy e6f4d6e6fa [Tests] Use stable order for ir/kotlinLike dumps
^KT-65406
2024-02-16 10:19:38 +00:00
Pavel Kunyavskiy 0fa42a9c11 [Tests] More conservative stableOrdered dump
Order of enum entries and fields matters, we can't sort them too.

^KT-65460
2024-02-16 10:19:38 +00:00
Pavel Kunyavskiy 5d4e822f42 [Tests] Enforce FIR_IDENTICAL for more irText tests 2024-02-16 10:19:37 +00:00
Pavel Kunyavskiy 5ddc31e932 [Tests] Add handler to regenerate irText testData
It is disabled by default, can be enabled by code change.
It's useful when changes in dumper is done with significant
amount of tests changed.

^KT-65460
2024-02-16 10:19:37 +00:00
Dmitriy Dolovov 1f257e98a0 [kotlinp] Add missing the dependency for kotlinp-jvm-shadow.jar
Without the dependency on project :tools:kotlinp the shadow Jar
lacks the necessary classes.

^KT-62340
2024-02-16 10:08:48 +00:00
cristiangarcia b8915614ae Make checkBuild configuration cache compatible
Required for KTI-1553
2024-02-15 22:39:46 +01:00
Dmitrii Gridin 7a13023b14 [FIR] add KDoc for FirResolvePhase 2024-02-15 19:28:10 +00:00
Yahor Berdnikau d662f72d07 [Gradle] Deprecate KotlinCompilation.compilerOptions
Users quite often confuse that compilerOptions in KotlinCompilation is
actually the same object in the Kotlin compilation task. We want to make
 our API more straightforward and remove this ambiguity by proposing to
 use task compiler options DSL.

^KT-65568 Verification Pending
2024-02-15 18:27:31 +00:00
Yahor Berdnikau 5df05d5797 [Gradle] Deprecate HasCompilerOptions
This DSL is not consistent with other DSL to configuring compiler
options.

^KT-65568 In Progress
2024-02-15 18:27:31 +00:00
Pavel Punegov 42cba927e6 [K/N][test] Infra: implement race-free way to separate test cases
With shared test running test cases that may fail or timeout should
be excluded from shared run and executed separately.
This is done by getting all test cases for the current executable and
putting them to the map that is checked for all TestRuns
2024-02-15 18:07:25 +00:00
Pavel Punegov 8dcb763eca [K/N][test] Reset state in StateMachineChecker before the test
boxInline tests for suspend use StateMachineChecker and share the state
if compiled and run together. The single value accessed from all tests.
It is enough to reset state before the test is run.
2024-02-15 18:07:25 +00:00
Pavel Punegov 07422d4feb [K/N][test] Implement shared test execution of TestCases
Added the ability to execute multiple tests once and share the results.
With Test runner turned on tests are being compiled into the single
executable. Then they executed each one separately using --ktest_*
options. This commit makes test run executable once and the result goes
to the result handler.
2024-02-15 18:07:25 +00:00
Yahor Berdnikau e3b7366b10 [Gradle] Compile Gradle plugins against Gradle API 8.5
^KT-65819 Fixed
2024-02-15 18:04:59 +00:00
Leonid Startsev a6cdf27204 Fix compilation of :tools:kotlinp-klib and related projects
Conflicting PRs https://jetbrains.team/p/kt/reviews/14253 and https://jetbrains.team/p/kt/reviews/14384/files
were merged too close to each other for Safe-Merge to catch the problem and therefore resulted in compilation error.
2024-02-15 17:15:58 +00:00
Jinseong Jeon 460339870a K2 UAST: lookup declarations mangled due to value class
^KT-65653 fixed
2024-02-15 17:02:04 +00:00
Jinseong Jeon 7e65f125cc Reproduce wrong binary resolution to fun w/ value class
^KT-65653
2024-02-15 17:02:03 +00:00
Nikolay Lunyak 8f8c7fe7cf [FIR] Properly calculate visibilities
`testIntersectionOfPrimitiveBasedFunctions`
is fine, because we deprecate this
already in ^KT-63243.

`CANNOT_INFER_VISIBILITY` is
positioned as `DECLARATION_NAME`,
just in case we decide for
some reason that we do want to
report it along with
`MANY_*_NOT_IMPLEMENTED`. In that
case, we'd get a problem that
their bounds overlap, but not
completely contain one another.

^KT-63741 Fixed
^KT-59400 Fixed
2024-02-15 16:10:14 +00:00
Nikolay Lunyak 7056ad5325 [FIR] Set status.isOverride for fake overrides
Even though SO may not be correct
overrides sometimes, it feels more
natural to treat fake overrides as...
well, "overrides". And without it
we'd need to make the code in
`FirOverrideChecker` less intuitive.
2024-02-15 16:10:13 +00:00
Nikolay Lunyak afd8895e51 [FIR] Introduce the PluginGenerated source kind
Make parcelize work consistently with
`FirOverrideChecker`.

Actually, there is a philosophical question about
what to do when a plugin generates a class
in a new package, and this class is red code
(for instance, doesn't implement an abstract
member from a supertype). There's no source
to report such an error, but we probably do
want to run checkers to avoid trying to
compile red code to binaries (because it may
crash in backend, or it may silently work).
2024-02-15 16:10:13 +00:00
Nikolay Lunyak 694029d67f [FIR] Run FirOverrideChecker for fake overrides
The change in
`FirOptInUsageBaseChecker` is needed
to prevent `OPT_IN_OVERRIDE` on
intersection overrides where one
of the base functions requires opt-in.
We never designed this in such
a way that it's an error.
See:
`FirPsiOldFrontendDiagnosticsTestGenerated.testIncorrectTargetsForExperimentalAnnotation`.

According to KT-63741, the case like
`kt40510.fir.kt` should, in fact,
be an error. It will be addressed
separately.
2024-02-15 16:10:13 +00:00
Nikolay Lunyak 686abb112d [FIR] Properly set sources of intersection overrides
Otherwise, they may point to one of
the base intersected functions, and
if we start reporting diagnostics on
them, they'll appear on base
functions.
2024-02-15 16:10:13 +00:00
Nikolay Lunyak 3b5fff5473 [FIR] Don't copy VP default values for fake overrides
In general, overrides should not
contain default values, and it's
better to make fake overrides be close
to proper overrides as much as
possible. It will be important when
we begin running `FirOverrideChecker`
for fake overrides.

^KT-63879 Fixed
^KT-65534
2024-02-15 16:10:13 +00:00
Nikolay Lunyak 249886fb13 [FIR] Ensure the case from KT-63741 works
^KT-63741
2024-02-15 16:10:13 +00:00
Nikolay Lunyak 2ad0be7bdc [FIR] Ensure the case from KT-63578 works
^KT-63578
2024-02-15 16:10:12 +00:00
Yahor Berdnikau 05359ba9e5 [Gradle] Migrate VariantAwareDependenciesMppIT to new test DSL
^KT-65528 In Progress
2024-02-15 16:09:34 +00:00
Dmitriy Dolovov ab814e1600 [KLIB tool] Update Kotlin/Native C-interop tests
^KT-62340
2024-02-15 15:38:27 +00:00
Dmitriy Dolovov 07767f88e2 [KLIB tool] Update KLIB metadata dump tests
^KT-62340
2024-02-15 15:38:27 +00:00
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