Commit Graph

102071 Commits

Author SHA1 Message Date
Alexander.Likhachev 76ba0c60b2 [Gradle] Update Gradle integration tests code as the new stdlib is now available
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 7690904bc4 [Gradle] Update AGP for KGP functional tests to support Gradle 8
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 862f8f235c [Build] Bump Gradle version to 8.1.1
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 786653baf2 [Build] Use separate sbom directories per publication
Currently, `SpdxSbomTask` declares output file not as `@OutputFile`, but `@OutputDirectory` leading to overlapping outputs problem. This way the problem is worked around.
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 407a2d4203 [Build] Remove usages of Provider.forUseAtConfigurationTime()
It's not required anymore and was deprecated since Gradle 7.4
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 58490ea184 [Build] Configure sourcesJar task dependencies explicitly
The `sourcesJar` task uses outputs of code generation tasks, thus it should be declared, so Gradle would know that's not a misconfiguration.
https://docs.gradle.org/8.1/userguide/validation_problems.html#implicit_dependency
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 3affe78ae5 [Build] Make K/N backend sources publishing for IDE in a less hacky way
The previous way was too hacky relying on internal API
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 8dd957d371 [Build] Mark kotlin.test publication variant not consumable
Their attribute sets are the same as for platform-specific publications, thus Gradle raises a legit deprecation warning here. These configurations are not being consumed directly, so it's fine to make them not consumable
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 01276bbe49 [Build] Fix buildscripts deprecation warnings
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander Udalov 1588b07472 Tests: unmute light analysis tests passing with JVM_IR 2023-06-22 17:10:51 +02:00
Alexander Udalov cab53361f3 Use JVM IR backend in light analysis mode tests
Add some more filters on private/synthetic stuff (which doesn't matter
in practice) to make full and light analysis mode dumps as similar as
possible, so that all existing tests will pass for JVM IR. Unmute some
tests which were failing with the old JVM backend.

Tests on repeatable annotations are muted because in full analysis,
annotations are wrapped into the container (e.g. `@A(1) @A(2)` ->
`@A$Container(A(1), A(2))`), but they are no in the light analysis mode.
So there's always going to be a difference for these tests between full
and light analysis, unless we're going to change behavior of kapt, which
would be a kind of a breaking change.

 #KT-58497 Fixed
2023-06-22 17:10:51 +02:00
Alexander Udalov 6cce510319 Tests: tweak light analysis mode test filters
Do not compare private and synthetic methods between full and light
analysis modes, some private fields, and InnerClasses attributes. This
is needed to prepare these tests for migration to JVM IR.
2023-06-22 17:10:51 +02:00
Alexander Udalov f56bbd68d7 Kapt+JVM_IR: generate stub bodies for property accessors
Similarly to how stub bodies are generated for functions in the kapt
mode (see `BodyGenerator.generateFunctionBody`).

This is more useful then not generating bodies at all, because otherwise
in the -Xjvm-default=all/all-compatibility modes it would be difficult
to differentiate functions with default implementations from the ones
without (because they all would lack body and thus be generated as
abstract into the resulting Java stub).

The effect of this change is pretty minor, so there's no YT issue. But
it fixes light analysis tests run with JVM_IR in
`codegen/box/jvm8/defaults`, because now there's no difference between
full analysis and light analysis for interfaces with default methods in
new modes.
2023-06-22 17:10:51 +02:00
Alexander Udalov 4ac6f01d31 Add ReplaceWithSupertypeAnonymousTypeTransformer to light analysis tests
To make these tests behave closer to kapt, since kapt is the primary use
case for the light analysis mode.

AbstractLightAnalysisModeTest compares the text dump of bytecode
obtained with full analysis and light analysis, removing things like
anonymous/synthetic entities. In the light analysis mode anonymous
objects in supertypes are always approximated, and in the full analysis
mode they are always present as is in signatures. So we're transforming
the text dump in the same way, by approximating anonymous objects in
signatures (more precisely, in return types of methods and fields) to
the supertype.
2023-06-22 17:10:51 +02:00
Alexander Udalov c5f44486a9 Rename KaptAnonymousTypeTransformer and move to frontend.java
This is needed in order to run light analysis mode tests for JVM IR
backend. In the subsequent commit, this extension is added to light
analysis mode tests.

Kapt stub generation uses this extension to transform local types to
non-local:

    private val x = object {}

With this extension, x's type will be `Any`. Without it, it will be an
anonymous type. This anonymous type was not a problem for the old JVM
backend, but it's difficult to translate it in the IR infrastructure in
the light analysis mode where bodies are not resolved.

When kapt stub generation works with JVM IR enabled,
KaptAnonymousTypeTransformer ensured that backend would not crash and
stubs would contain something useful.

However, this is not happening in light analysis mode tests, which are
supposed to check how compiler behaves in the light analysis mode which
is used in kapt.
2023-06-22 17:10:50 +02:00
Kirill Rakhman c95a9ff55e [FIR] Only mark declaration name with ACTUAL_WITHOUT_EXPECT
#KT-58827 Fixed
2023-06-22 14:59:19 +00:00
Vladimir Sukharev 3e6175fe30 [Test] Convert IGNORE: NATIVE directives in box tests "super"
^KT-59057

Merge-request: KT-MR-10764
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-22 14:50:18 +00:00
Pavel Mikhailovskii 9f763deea1 KT-59325 [SLC] Fix generation of fields from companion objects 2023-06-22 14:48:12 +00:00
Anna Kozlova 190d49a1e0 [light classes] optimize accessors retrieval
Avoid expensive calls to `navigationElement` for methods
that cannot be getters/setters and would be filtered later.
Repeat partly naming generation strategy.

Merge-request: KT-MR-10689
Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
2023-06-22 14:14:39 +00:00
Vladimir Dolzhenko 7e9a897ef3 Provide equals/hashCode based on psiElementSource
#KT-59445
2023-06-22 14:14:18 +00:00
Vladimir Dolzhenko d0477a6a30 Provide equals/hashCode based on original PSI to avoid potential PCEs
#KT-59445
2023-06-22 14:14:18 +00:00
Vladimir Dolzhenko 05652e7d8d Improve exception handling and reporting
#KT-59445
2023-06-22 14:14:18 +00:00
Ilya Goncharov d865202bd5 [Wasm] Inline _importModule
^KT-59556 fixed
2023-06-22 13:56:47 +00:00
Pavel Punegov 1ad0a662fd [K/N] XCTest support: Make compiler produce bundles
XCTest test binary is a bundle plug-in that is similar to a framework.
This is a part of ^KT-58928

Merge-request: KT-MR-10662
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-06-22 13:23:17 +00:00
Anna Kozlova 92bcf3b2d5 [psi] packageCache: avoid pair as a key
supposedly, when search for package is performed,
it's performed multiple times with different names
but for the same scope.
In this situation, extracting scope from key brings a lot of memory.
For IJ, it reduces load from 7Mb -> 4Mb
2023-06-22 12:52:03 +00:00
Anna Kozlova abdc44c18a [LL] support search for decompiled fir for type parameters
^ KTIJ-25976
2023-06-22 12:51:44 +00:00
aleksandrina-streltsova d439bdd49f Move ClassId for IntrinsicConstEvaluation to StandardClassIds
^KTIJ-19863
2023-06-22 12:33:52 +00:00
aleksandrina-streltsova 3477d35168 [AA] Provide expected type for annotation entry argument
^KTIJ-19863
2023-06-22 12:33:51 +00:00
Mikhail Glukhikh fa6b1e24f9 FE: perform IOT approximation after resolution & inference
#KT-54917 Fixed
2023-06-22 12:29:11 +00:00
Mikhail Glukhikh 7884d9a61e K2: reproduce KT-54917 2023-06-22 12:29:11 +00:00
Ilya Goncharov 1c89a7e400 [JS] Remove legacy and output prefix-postfix tests 2023-06-22 12:25:24 +00:00
Ilya Goncharov 1465abcfed [JS] Source map to IR 2023-06-22 12:25:24 +00:00
Ilya Goncharov 5783693039 [JS] Remove js legacy codegen 2023-06-22 12:25:24 +00:00
Ilya Goncharov e7e6fba81f [JS] Fix JS legacy incremental 2023-06-22 12:25:24 +00:00
vladislav.grechko 38e9dfc823 Evaluate apiVersionIsAtLeast on compile time while IR-inlining
IR inliner should evaluate `apiVersionIsAtLeast` on compile-time (except
cases of inlining to inline functions from kotlin runtime) just as
bytecode inliner does.

^KT-59291: Fixed
2023-06-22 11:55:04 +00:00
Nikolay Lunyak f4f9f1f8f8 [Tests] Remove temporary directories check from finalize
This implementation of `finalize()` is incorrect. See: https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#finalize()

> If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

> If a subclass overrides finalize it must invoke the superclass finalizer explicitly.

Instead of providing help by highlighting the tests that forget to clear the temporary directories, this `finalize()` causes OOM.

Merge-request: KT-MR-10756
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-06-22 11:43:21 +00:00
Dmitrii Krasnov 0e51a00871 Migrated CommonizerIT to new test dsl (junit 5 and gradle test kit) 2023-06-22 10:35:56 +00:00
Dmitrii Gridin b22769919e [LL FIR] LLFirProvider: do not return unrelated FirFile for synthetic declarations
We do not expect to get a FirFile that is not associated with our requested element

^KT-59505
2023-06-22 10:22:37 +00:00
Dmitrii Gridin 34a871e0b0 [LL FIR] LLFirProvider: move backing field check to helper function
^KT-59505
2023-06-22 10:22:37 +00:00
Dmitrii Gridin f74d4494aa [LL FIR] fix designation path for synthetic declarations
A designation path for synthetic declarations like fake override
or member delegate contained the wrong FirFile, because it
was provided by the original declaration that is wrong.
So we should pick up the file from our path, because it shouldn't be
synthetic

^KT-59505 Fixed
2023-06-22 10:22:37 +00:00
Vladimir Sukharev a3758bf70b [K2/N] Mute failed test
^KT-58863

Merge-request: KT-MR-10762
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-22 10:01:01 +00:00
Jinseong Jeon 799aadfacf AA: add an option to create Application env for production v.s. test mode
...and use production mode by default for AA standalone

^KT-59511 Fixed
2023-06-22 11:32:29 +02:00
Pavel Mikhailovskii 134b02c754 KT-59563 [SLC] Fix type erasure in $annotations methods of extension properties 2023-06-22 09:06:12 +00:00
Vladimir Sukharev 3d60ed8874 [Test] Convert IGNORE: NATIVE directives in box tests from A to C
^KT-59057

Merge-request: KT-MR-10747
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-22 08:39:20 +00:00
Ilya Goncharov 2da0e622c0 [Gradle, JS] Add FIR variant of incremental multiproject test
^KT-56933 fixed
2023-06-22 08:21:00 +00:00
Dmitriy Dolovov 2e43fa7cd0 [PL][tests] Adapt tests for K/N to the conditions when static cache is used w/o lazy IR 2023-06-22 08:10:11 +00:00
Igor Chevdar 5f3dad14a2 [K/N] Make -Xlazy-ir-for-caches disabled by default 2023-06-22 08:10:11 +00:00
Igor Chevdar cc9dd48c09 [K/N] Support non-LazyIR for cached libraries
Use the same lazy deserialization mechanism (inline function bodies, class fields)
for both LazyIR and usual IR
2023-06-22 08:10:11 +00:00
Kirill Rakhman 6318da0f02 [FIR] Remove or replace whole expressions in FIR diagnostic messages
FIR expressions rendered by FirRenderer don't look very nice in error
messages anyway, and additionally, they can become arbitrarily large,
so we shouldn't use them in messages.

#KT-59449 Fixed
2023-06-22 08:02:07 +00:00
Dmitriy Novozhilov 0f0f0d604f [FIR] Expand typealiases before checking type of class literal 2023-06-22 07:09:15 +00:00