Commit Graph

1621 Commits

Author SHA1 Message Date
Pavel Kirpichenkov 00faa6fa01 [Tests] Support language features from test data in .knm meta compiler
Mute test failure revealed by unblocked context receivers (KTIJ-28885)

KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov ae664d37ae [Tests] Support KLIB metadata for stdlib in test compile utility
Create dependency provider able to resolve code from .knm metadata
files to simplify migration from the legacy kotlin-stdlib-common
artifact.

KTIJ-28668
KTI-1457
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 9373437cad [Tests] Add kotlin-stdlib dependency in KLIB metadata compile utility
It's necessary, for instance, to compile custom contracts in common

KTIJ-28668
KTIJ-26788
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 3e5065fbba [Tests] Report compilation errors from test KLIB compiler
KTIJ-28668
2024-02-26 10:18:38 +00:00
Nikita Nazarov 407448d8e3 [JVM] Implement new inlined variable naming format
^KT-65478 fixed
2024-02-23 23:59:13 +01:00
Dmitrii Gridin 072d191306 [compiler] replace Enum values() with entries
To fix warnings. Also, use of `Enum.entries` may improve the performance

^KT-48872
2024-02-20 17:56:46 +00:00
Alexander Udalov 12f393791b JVM: allow -jvm-target 1.8 with -Xjdk-release=1.6
#KT-59098
2024-02-19 11:44:58 +00:00
Alexander Udalov cdcb65c749 Tests: minor, slightly move JDK path substitution logic
It will be used in other CLI tests in subsequent commits.
2024-02-19 11:44:58 +00:00
Dmitriy Novozhilov d9beae0556 [Test] Change indent from four to two spaces in generated tests
This is needed to reduce the size of generated test files, which started
  to exceed default IDE limit
2024-02-16 12:48:24 +00:00
Dmitriy Novozhilov 9b5a9ccba8 [Test] Don't generate throws Exception on methods of generated tests
This is needed to reduce the size of generated test files, which started
 to exceed default IDE limit
Also update some (mostly old) test utilities to remove exceptions from
 java signatures
2024-02-16 12:48:24 +00:00
Dmitrii Gridin 717dd08fd4 [LC] PsiClassRenderer: render type parameter annotations
^KT-65112
2024-02-15 15:18:02 +00:00
Evgeniy.Zhelenskiy f05c972efb [K2, CLI] Support endOffset in Kotlin CLI
Duplicated messages in testdata appeared because default renderer
renders diagnostic spans ambiguously. It shows only start position.
In fact, there are 3 failures, 2 of them distinguish only by the
diagnostic end offset. See youtrack for more information.

The issue about inconvenient rendering is KT-64989.

#KT-64608
2024-02-05 13:26:13 +00:00
Alexander Udalov 9d5e1bdc47 CLI: remove obsolete -Xallow-result-return-type 2024-02-01 23:37:23 +00:00
Alexander Udalov 49c659b379 CLI: remove obsolete -Xdump-declarations-to
It was only used in the very old version of binary compatibility
validator. It was never supported in the JVM IR backend.
2024-02-01 23:37:23 +00:00
Sergej Jaskiewicz f39335b3f7 [klib] Don't pass around metadata serialization closure
Pass the metadata serializer instance instead. This allows to further
reduce code duplication by introducing the common interface
`KlibSingleFileMetadataSerializer` for abstracting away K1 and K2
representation of a source file, as well as reusing
`Fir2KlibMetadataSerializer` across different backends.

KT-64392
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz 5a6f51e474 [klib] Move KlibMetadataSerializer to serialization.js
It's used only in JS compilation.
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz 93a1ceae75 [klib] Deduplicate KLIB serialization logic in K/JS and K/N
Introduce the new `serializeModuleIntoKlib` function that all KLIB-based
backends can use to serialize a module to a KLIB.

^KT-64392 Fixed
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz c335cd0b1e [IR] Remove unused IrMessageLogger from serialization logic 2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz f88d09a2f6 [IR] Move KtDiagnosticReporterWithImplicitIrBasedContext to ir.tree
So that it could be accessible from the `ir.serialization.common` module
2024-01-29 21:07:43 +00:00
Marco Pennekamp dcf7b84082 [Test] Reset ApplicationManager.application when shared application environments are disposed
- Shared application environments can be disposed in the middle of test
  plan execution when the project count reaches zero. So resetting
  `ApplicationManager` only on "test plan execution finished" is
  incorrect, because it does not account for that scenario. Instead, we
  should reset `ApplicationManager` every time the application
  environment is disposed.
- We should also keep the manual reset in `testPlanExecutionFinished`
  because `disposeApplicationEnvironment` may not need to dispose
  anything if there isn't a shared application environment, but we
  should still reset `ApplicationManager` if an unshared application
  environment was created.
- This fixes "Some test disposed, but forgot to clear MockApplication"
  exceptions which appeared after KT-64099 because it opened up proper
  disposal of the shared application environment (instead of it being in
  a state of leakage because not all project disposables were properly
  disposed).

^KT-63650
^KT-64099
2024-01-23 21:52:31 +00:00
Iaroslav Postovalov 29c68c8aa7 [Tests] Add JavaAgainstKotlin tests for K2
^KT-64405 Fixed
2024-01-15 23:25:47 +00:00
Sergej Jaskiewicz eda30ff704 [klib] Implement diagnostics for clashing KLIB signatures
Now, we detect clashing signatures during serialization to KLIB and
report a compiler error if two or more declarations have the same
`IdSignature`

For example, for the following code:
```kotlin
@Deprecated("", level = DeprecationLevel.HIDDEN)
fun foo(): String = ""

fun foo(): Int = 0
```

the compiler will produce this diagnostic:
```
e: main.kt:1:1 Platform declaration clash: The following declarations
       have the same KLIB signature (/foo|foo(){}[0]):
    fun foo(): String defined in root package
    fun foo(): Int defined in root package
e: main.kt:4:1 Platform declaration clash: The following declarations
       have the same KLIB signature (/foo|foo(){}[0]):
    fun foo(): String defined in root package
    fun foo(): Int defined in root package
```

Note that we report this diagnostic during serialization and not earlier
(e.g., in fir2ir) for more robustness, so ensure that we check
exactly the signatures that will be written to a KLIB.
If we later introduce some annotation for customizing a declaration's
signature (e.g., for preserving binary compatibility), this
diagnostic will continue to work as expected.

^KT-63670 Fixed
2024-01-12 15:59:28 +00:00
Alexander.Likhachev 21b438f55d Replace the trove4j collections usages with the fastutil ones
The trove4j library is licensed under LGPL, and that causes some troubles while working with it. The fastutil library provides the same functionality in the context of our needs, and is licensed under the Apache license.
^KTI-1135 In Progress
2024-01-10 11:29:25 +00:00
Alexander Zakharenko 62facee96c [K/N] Debug output for flaky testReleaseCompilerAgainstPreReleaseLibrary
^KT-64822
2024-01-10 09:49:41 +00:00
Sergej Jaskiewicz 2096d22e18 [IR] Mark IrBlockBodyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz f482b6a458 [IR] Mark IrValueParameterImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Marco Pennekamp 32fe29b8cc [Test] Add debug names to unnamed test disposables
- This helps to track down disposables which are never disposed, and
  reduces confusion when printing disposables in general (the names will
  now be meaningful, instead of endless lists of "newDisposable" and
  "TestDisposable").

^KT-64099
2023-12-19 11:12:23 +00:00
Ilya Gorbunov d2aae67e03 Replace kotlin-test project dependencies in the project
Use dependency helper function that chooses whether to take them
from the bootstrap repository or from a configuration of kotlin-test

KT-61969
2023-12-13 15:40:25 +00:00
Pavel Kunyavskiy e80d4b1d60 [IR] Move IrDeclaration.isExpect to IrUtils
^KT-62292
2023-11-20 08:31:41 +00:00
Vladimir Sukharev c38a0e10af [K/N] Implement a concept of conditional ignore of K/N blackbox tests
^KT-59288 Fixed
2023-11-15 19:03:07 +00:00
Alexander Udalov c1c9549b4f Tests: minor, remove obsolete deprecated AbstractBytecodeListingTest 2023-11-02 10:59:28 +00:00
Dmitriy Novozhilov fb8bf19091 [IR] Rename IrSymbolInternals to UnsafeDuringIrConstructionAPI
The new name more precisely describes the meaning of this opt-int
2023-10-25 11:32:46 +00:00
Ilya Goncharov a79324037d [JS] Fix JPS artifacts cordinates 2023-10-16 13:34:37 +00:00
Svyatoslav Kuzmich a10042f909 [Wasm] Add K2 checkers.wasm module (KT-56849)
Add first K2 checker ExternalInheritanceChecker to test the infra
2023-10-12 13:26:58 +00:00
Mikhail Glukhikh 072757cdde Test: convert IR source ranges test to the new infrastructure
Related to KT-59864, KT-60111, KT-59584
2023-10-10 13:38:51 +00:00
Alexander Udalov 5ff15f6847 CLI tests: fix incorrect order of replacing versions
The change 9de6df6104 caused tests `requireKotlinCompilerVersion{,K2}`
to fail once the compiler version was changed to 2.0.0-dev-*. The reason
is that when patch version is 0, compiler version is equal to the
language version (which is itself always equal to JvmMetadataVersion).
So if we're replacing JvmMetadataVersion first, we end up with
`$ABI_VERSION$-dev-...` in the output, which is incorrect.
2023-10-02 08:59:12 +00:00
Mikhail Glukhikh 156097fe17 Restore KotlinCompilerVersion.IS_PRE_RELEASE
This commit is a slightly modified revert of 4f29c113.
IS_PRE_RELEASE allows to make LATEST_STABLE version behave as
experimental when this flag is set to true.
The general goal is to prepare fix of KT-62058; after this commit
one can do it by changing IS_PRE_RELEASE flag to true.
The fix of KT-62058 is planned to be done during bootstrapping.
This preparation and the future fix are parts of umbrella KT-61951.
2023-09-21 20:09:25 +00:00
Mikhail Glukhikh d8b3dd683e Use FIR compiler properly in AbstractTopLevelMembersInvocationTest 2023-09-19 15:46:29 +00:00
Dmitriy Dolovov a2e148173d [JS] Don't produce metadata-only (IR-less) KLIBs in JS
The scenario when JS source code is shared between a few JS common
source sets is not supported in Kotlin Multiplatform.

^KT-61136
2023-09-18 17:58:43 +00:00
Kirill Rakhman e8731f3f31 [FIR] Use resolvedType instead of coneTypeOrNull in tests
#KT-61367
2023-09-14 10:03:02 +00:00
Alexander Korepanov be4f6beddb [JS Tests] Prepare JS tests for testing backend diagnostics
- Introducing a backend diagnostic handler.
 - Moving JS diagnostic tests from test-common to
   js.test to avoid circular module dependencies.

^KT-61886 Fixed
2023-09-13 12:19:15 +00:00
Alexander.Likhachev 6eaccc997f [Build] Fix the typo junit jupyter -> jupiter 2023-09-06 22:47:34 +00:00
Alexander.Likhachev 6f96be0b76 [Build] Get rid of the testApiJUnit5 method
#KTI-1349 In Progress
2023-09-06 22:47:34 +00:00
Alexander.Likhachev 7a1dc1f89b [Build] Do not add ij dependencies in testApiJUnit5
This is not needed since the dependencies are already declared as API dependencies in the relevant projects.
#KTI-1349 In Progress
2023-09-06 22:47:33 +00:00
Alexander.Likhachev 357d12fc8e [Build] Move JUnit dependencies into the version catalog
The `kotlin-test` dependencies are left untouched as changing them affects publications, thus these versions are independent from the used inside our build
#KTI-1349 In Progress
2023-09-06 22:47:33 +00:00
Dmitriy Novozhilov 2d334c4e71 [Test] Merge multiple abstract legacy test runners into a single one
There was only one real inheritor of AbstractFirBaseDiagnosticTest,
  so there is no need in the whole hierarchy of abstract test runners

Also AbstractFirOldFrontendLightClassesTest is not intended to check any
  diagnostics or CFG dumps, so this logic was removed (they still can be
  checked using non-legacy AbstractFirDiagnosticTest from the main test
  infrastructure)
2023-09-05 14:59:36 +00:00
Dmitrii Gridin c095b60fe8 [LL FIR] drop outdated LazyBodyIsNotTouchedTest
We have our own transformers and tests against compiler test data,
so separate test with compiler transformers is redundant
2023-09-04 12:37:12 +00:00
Aleksei.Cherepanov 68af705664 Add import tracker
This tracker reports import directives to IJ's JPS to track changes and detectwehen it is needed to adjust compilation scope.

#KT-44835 Fixed
2023-08-30 12:42:39 +00:00
Kirill Rakhman bb8a46c3a0 [Test] Parallelize test generation 2023-08-28 08:02:05 +00:00
Bogdan Mukvich 7b00323b89 [Build] Update guava
Fix some reports from "Show Vulnerable Dependencies"

^KTI-1342
2023-08-25 14:10:37 +00:00