Commit Graph

1632 Commits

Author SHA1 Message Date
Dmitrii Gridin 2fbde7a85c [Analysis API] reuse PsiClassRenderer for PsiType render
To align the format with light classes as now we are powered by them

^KT-66603
2024-03-19 13:57:23 +00:00
Dmitrii Gridin 3c8a95e623 [LC] render all type annotations in tests
^KT-66603
2024-03-19 13:57:23 +00:00
Vladimir Sukharev e03af07a1c [Tests] Revive KlibEvolutionTests
Allows CI testing for KT-44602, KT-44604, KT-44598, KT-44599, KT-66342

^KT-44602
2024-03-16 07:50:33 +00:00
Alexander Udalov 32c8664f71 Tests: remove JVM diagnostics from AbstractDiagnosticsTest
There's no behavior specific for JVM backend diagnostics in any of the
affected tests, and this code is using an incorrect way to obtain those
diagnostics, so it should be removed anyway.
2024-03-15 14:39:56 +00:00
Dmitriy Novozhilov f288163cbc [Test] Use rethrow for checked exception in java-written tests
In 9b5a9ccb `throws Exception` was removed from java test sources and
  all checked exceptions were wrapped with `RuntimeException`

But it was forgotten that there is a `rethrow` utility, which doesn't
  wrap exception but makes the javac happy at the same time
2024-03-14 11:04:02 +00:00
Dmitriy Novozhilov 09c27d78b8 [Test] Revert not-needed change in KotlinTestUtils
The corresponding test was incorrectly muted in c818ce92
2024-03-14 11:04:02 +00:00
Dmitriy Novozhilov c818ce9220 [Test] Add test for KT-66338 2024-03-13 09:17:17 +00:00
Dmitriy Novozhilov d352cc9d96 [Frontend] Make DiagnosticSuppressor a project-level extension
Originally it was an application-level component, which caused non-trivial
  logic and cognitive load to carefully handle those extensions to avoid
  memory leaks.

6740a596 introduced a way to easily register `DiagnosticSuppressor` to
  project, and this commit continues this work, making it a proper
  project-level extension

A lot of changes caused by the fact, that this extension is needed to be
  obtained from `BindingContext` (see `BindingContextSuppressCache` and
  its usages), so almost all changes are introducing `Project` to
  `BindingContext`

^KT-66449 Fixed
2024-03-12 06:43:58 +00:00
Wojciech Litewka cbabfc0fe2 [IR] Drop ir.ir2cfg module
#KTI-952 Fixed
#KT-65773 Related
2024-03-06 18:30:22 +00:00
Ilya Goncharov b157a8eae5 [Wasm] Add wasm target to Klib manifest
^KT-66327 fixed
2024-03-06 10:57:50 +00:00
Kirill Rakhman 3c23319f70 [Test gen] Remove duplicate checks if file is equal to some string 2024-02-28 15:20:30 +00:00
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