Commit Graph

1149 Commits

Author SHA1 Message Date
Pavel Kunyavskiy d797505f06 [K/N] Drop merging forward and real declaration in deserializer
^KT-59643
2023-07-24 08:24:20 +00:00
Dmitriy Dolovov 938146749d [PL][tests] K/JS: Avoid any unexpected warnings to appear in tests 2023-07-17 21:09:40 +00:00
Dmitriy Dolovov 715aba3d18 [PL][tests] K/JS: Run compiler through CLI interface 2023-07-17 21:09:40 +00:00
Ivan Kylchik 076305bb78 [Test] Drop SMAPTestUtil.kt file
It is not used anywhere. Probably left after transition to new test
infrastructure.
2023-07-11 09:30:26 +00:00
Ilya Goncharov a6d461dbe8 [JS] Fix compile kotlin against custom binaries 2023-07-06 08:08:55 +00:00
Ilya Goncharov 148d8c9246 [Gradle, JS] Migrate JS cli tests to ir backend 2023-07-05 07:10:06 +00:00
Ilya Goncharov 08041230f0 [JS] Migrate checkers diagnostics test to IR backend 2023-07-04 18:04:14 +00:00
Kirill Rakhman 2cc588d6d8 [RAW FIR] Rename raw FIR builder types for clarity 2023-06-30 12:05:43 +00: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 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
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
Alexander Udalov 70e9245867 Revert "tmp: implement a hack to fix LA test"
This reverts commit 0387ce0365.

This change was not needed because the 'IGNORE_BACKEND_K1: JVM'
directive makes the test generated as ignored, in this case it is the
method named `ignoreSignedToUnsignedConversions` which is not even
recognized as a test.
2023-06-13 16:19:53 +00:00
Nikolay Lunyak 70605c84df [FIR Native] KT-58549: Get rid of the builtin provider
According to
`FirNativeCodegenBoxTestGenerated.testNestedClassesInAnnotations`,
the annotation
`kotlin.internal.PlatformDependent` is
unresolved reference.

^KT-58549 Fixed
2023-06-01 10:27:54 +00:00
Ilmir Usmanov d7fd2471b8 JVM IR: Remove remains of 1.2 coroutines from tests
Remove CoroutineAdapter and LANGUAGE: +ReleaseContinuation,
which are meaninless now.
Update the tests accordingly.
2023-05-31 05:56:18 +00:00
Denis.Zharkov 67d51eb7ee Add a separate test configurations for JDK 21 dependent test
After it's released, there would be no need in them, but right now
they are unavailable through the toolchain, so we can't require it.
See KT-58765 for tracking

But there should be a dedicated Build configuration with JDK_21_0 env
properly set.

^KT-58716 Fixed
2023-05-22 09:19:52 +00:00
Sergej Jaskiewicz 3deea96b53 [IR] Introduce DumpIrTreeOptions for customizing IR dump
We plan to add more options => using a data class is better
than multiple function parameters
2023-05-15 15:47:34 +00:00
Alexander Udalov d757847ed6 JVM: enable -Xlambdas=class for some backend tests
These tests are checking the specifics of the class-generated lambdas.
2023-05-12 15:21:00 +00:00
Nikolay Lunyak 931894ab3c [FIR] KT-57655: Add the missing condition
^KT-57655 Fixed
2023-04-25 10:57:08 +00:00
Dmitriy Dolovov e85406b561 [PL][tests] Learn PL test infra to work with JS files
^KT-57378
2023-04-25 08:00:14 +00:00
Nikolay Krasko 760a690c01 [213] Remove some old setting in tests with org.jdom.Element
KTI-1114
2023-04-21 13:19:05 +00:00
Roman Golyshev b62b21dd67 [213] Adapt to DebugUtil.psiToString semantics change
See 83990991cd17c661bf6ea85b54125c09741d90ec commit in intellij

KTI-1114
2023-04-21 13:19:04 +00:00
Roman Golyshev d4cffb8a5a [213] Switch to 213 platform
KTI-1114
2023-04-21 13:19:04 +00:00
Dmitrii Gridin 22b5d940f1 [FIR] move lazy expression assertions to more common class
^KT-56543
2023-04-19 20:12:42 +00:00
Artem Kobzar 33c5068b79 [K/JS] Rework IR deserialization and lowering phases to consume less memory 2023-04-19 13:10:19 +00:00
Dmitriy Dolovov 87125d0703 [PL] Fix: Don't run partial linkage on early stages when no external dependencies have been loaded yet 2023-04-18 09:22:54 +00:00
Dmitriy Dolovov b08d805f1e [JS][tests] Support FIR for KLIB evolution tests 2023-04-04 20:18:18 +00:00
Dmitriy Dolovov 1fef48bb60 [PL] Log partial linkage messages at different severity
As specified in -Xpartial-linkage-loglevel CLI argument.
2023-03-31 18:29:44 +00:00
Leonid Shalupov 34c82011fc Remove copying of transient fields in argumentUtils
Current code in argumentUtils handles transient fields incorrectly
and copies them (not intended behaviour)

change is required for further work in arguments handling

ref https://jetbrains.team/im/review/3CCOfH4ffz5J?message=9fPd30T1rQz&channel=1y9ZTj2JB0aG
2023-03-29 20:20:02 +01:00
Dmitriy Dolovov 5f1c09cc24 [PL][tests] Rename KLIB ABI tests to Partial Linkage tests 2023-03-29 16:20:14 +00:00
Dmitriy Dolovov 8147aa7dd6 [PL][tests] Don't compile source->binary directly in Native KLIB ABI tests
Avoid using source+KLIB+cache?->binary compilations in KLIB ABI tests. Such compilations are not supported by Native K2 and thus will block migrating ABI tests to K2.
2023-03-29 16:20:14 +00:00
Simon Ogorodnik ae32eff543 KT-57154: Fix JRT-FS contents served for wrong JDK home on JDK 9+
If the compiler runtime JDK is 9+,
it will already contain JrtFileSystemProvider and won't use provided
classloader
In order to fix KT-57154 we need to provide "java.home" argument to
newFileSystem

In order to reduce the severity of the leak in KT-56789 we cache
instances of FileSystem itself forever
Otherwise, each invocation of newFileSystem on JDK 9+ will leak
classloader, which is created deep inside the JDK code

Add unit test for JRT-FS contents served through CoreJrtFs

Add Gradle Integration test to 
test if the daemon correctly reads JDK contents from the specified 
toolchain and not from its runtime JDK

^KT-57154
Regression test for ^KT-57077
2023-03-28 10:38:46 +00:00
Dmitriy Dolovov 4f1155b06f [PL] ABI compatibility tests for reworked partial linkage 2023-03-23 10:24:27 +00:00
Dmitriy Dolovov 2a4d880037 [PL] Deep rework of the partial linkage
1. Leaving no unbound symbols in the IR tree, KT-54491:
   - All unbound symbols are bound to synthetic stub declarations
   - Improved detection of the root cause for every partially linked classifier
   - Improved error messages

2. Visibility valiation, KT-54469

3. Always check deserialized symbols:
   If the deserialized symbol mismatches the symbol kind at the call site in the deserializer then generate and reference another symbol with the same signature. In case PL is off, just throw IrSymbolTypeMismatchException.

4. Handle class inheritance violation:
   - Detect illegal inheritance (ex: inheriting from a final class)
   - Detect invalid constructor delegation (ex: delegating to another class than the direct superclass)
   - Simplification: Reduce the number of PartialLinkageCase subclasses
   - Reworked error message generation to have shorter and clearer messages

5. Handle class transformations and all known side-effects, examples:
   - nested <-> inner
   - class <-> enum/object
   - adding/removing subclasses of sealed class
   - adding/removing enum entries

6. Check direct instantiation of abstract class.
   Such instantiation could be possible if a class was non-abstract in the previous version of a library.

7. Handle unlinked annotations on declarations.
   Such annotations are removed from the IR. The appropriate compiler error message is produced for every individual case.

8. Handle value argument count mismatch at call sites

9. Handle calling suspend function from non-suspend context.
   This could happen if a suspen function was non-suspend in the previous version of a library.

10. Handle overriding inline callables.
    Only the leaf final callable can be marked with `inline`.

11. Detect illegal non-local returns from noinline/crossinline lambdas.
2023-03-23 10:24:27 +00:00
Dmitriy Dolovov dc05683f59 [PL][tests] Fix: Properly count test steps in KLIB ABI compatibility tests 2023-03-23 10:24:26 +00:00
Sergej Jaskiewicz 27ccef868a [test] Run irText tests against K1 frontend for JS 2023-03-22 15:18:17 +00:00
Sergej Jaskiewicz c1ea3e7b53 [test] Give IrText test classes more descriptive names
The names now reflect the frontend and the backend used to run the tests
2023-03-22 15:18:15 +00:00
Dmitrii Gridin a5e5e093c3 [LL FIR] pass correct phase to AbstractLazyBodyIsNotTouchedTest test
We have lazy expressions on ARGUMENTS_OF_ANNOTATIONS,
so we should decrease the phase to it

^KT-56543
2023-03-22 14:08:39 +01:00
Mads Ager a525983e38 [JVM IR] Use error types in KAPT mode for unresolved delegate types.
^KT-57388 Fixed
2023-03-21 22:09:14 +01:00
Ilya Chernikov fea344faa4 Test infra: fix regexes relying on \n line endings 2023-03-21 07:53:13 +00:00
Artem Kobzar 4da81b2b6e [K/JS] Remove an internal system property and replace it with the new compiler flag 2023-03-17 12:38:34 +00:00
Ilya Chernikov 0387ce0365 tmp: implement a hack to fix LA test
due to a missing mechanism to handle a case when LA succeeds while
codegen fails. See detailed comment in the source.
Fixes implicit conversion test introduced in the previous commit.
2023-03-17 08:57:52 +00:00
Denis.Zharkov bcbe26287a Adjust CLI tests for JSR305 annotations being extracted
See the previous commits
2023-03-16 14:43:04 +00:00
Nikolay Krasko 57934a6870 Revert "Revert "[K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing""
This reverts commit c0c692844e.
2023-03-10 14:24:49 +01:00
Nikolay Krasko c0c692844e Revert "[K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing"
This reverts commit 6964121c15.
2023-03-10 13:14:10 +00:00
Vladimir Sukharev 6964121c15 [K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing
Merge-request: KT-MR-9081
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-09 18:56:30 +00:00
Ivan Kochurkin de5b475f7a [FIR] Use KlibBasedSymbolProvider in FirCommonSessionFactory
Unify logic of KLib resolving (Common and JS)

^KT-56354 Fixed
2023-03-03 20:58:24 +00:00
Ivan Kochurkin d783bbe5e9 [Tests] Do not throw assert in TestFiles.createTestFiles
This assert makes a test red even if it contains IGNORE_BACKEND directive
2023-03-01 22:10:11 +00:00
Vladimir Dolzhenko 3e99807436 Add ability to provide specific AbsentDescriptorHandler
#EA-457188

Merge-request: KT-MR-8900
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-02-22 12:44:46 +00:00
Nikolay Lunyak a9343aeb7d [FIR] KT-55840: Ensure everything actually works
This inconsistency is present due to not using the `// WITH_STDLIB`
in the above tests. When K1 creates the enum, it tries to generate
`entries()`, and for that it tries to load `kotlin.enums.EnumEntries`,
but this is actually an unresolved reference. K1 silently swallows it,
and proceeds.

The reason K2 doesn't fail is that in order to generate `entries()` it
simply creates the necessary `ConeClassLikeType` with the desired
`classId` instead of loading the whole `ClassDescriptor`.

The reason we can still observe `$ENTRIES` and `$entries` in K1
is because they are generated during the JVM codegen, and it
only checks if the `EnumEntries` language feature is supported. It
doesn't check if the `entries` property has really existed in IR
(by this time it's expected to have already been lowered to the
`get-entries` function - that's why "has ... existed").

The reason why the codegen doesn't fail when working with
`kotlin.enums.EnumEntries` is because it creates its
own `IrClassSymbol`.

^KT-55840 Fixed

Merge-request: KT-MR-8727
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-02-10 16:57:51 +00:00