Commit Graph

110140 Commits

Author SHA1 Message Date
Dmitrii Krasnov a2a0e8cb38 [Gradle] Fixed CC connected IT
Also provided a Configuration Cache Integration Test for downloading K/N

^KT-66422
2024-03-14 17:07:21 +00:00
Wojciech Litewka fae50f1258 [tree generator] Drop deprecated IrPackageFragment.fqName 2024-03-14 17:07:02 +00:00
Wojciech Litewka c1266daf73 [tree generator] Remove AbstractField.defaultValueInBase
It is now unneeded, and future needs should be possible to
be resolved otherwise.
Removing it will simplify further changes to tree generator,
especially for IR.
2024-03-14 17:07:02 +00:00
Wojciech Litewka 6b9a671476 [IR] Minor: Specify IrPackageFragment.fqName literally in IrTree
It is not a real field, only a compatibility facade for another one.
Needed for the next commit.
2024-03-14 17:07:02 +00:00
Wojciech Litewka 5e9c3025bb [IR] Move IrValueDeclaration.isAssignable to extension property
to remove custom logic from generated classes, in particular
to simplify source generator itself.
2024-03-14 17:07:02 +00:00
Ivan Kylchik ddcef6396e [IR] Drop inlineArgumentsWithOriginalOffset from inliner
#KT-66509
2024-03-14 16:00:53 +00:00
Ivan Kylchik 3ee126de74 [IR] Drop alwaysCreateTemporaryVariablesForArguments from inliner
This parameter was always set to be true.

#KT-66509
2024-03-14 16:00:53 +00:00
Leonid Startsev 75c87dd858 Update changelog and migration guide of kotlin-metadata-jvm
To accommodate for a future stable release as a part of Kotlin distribution.

See also: KT-63156, KT-63161, and KT-63219
2024-03-14 15:34:06 +00:00
Leonid Startsev cc343d7fb3 Add KmFlexibleTypeUpperBound.Companion and JVM_PLATFORM_TYPE_ID extension on it.
Because `public JvmTypeExtensionVisitor` was removed, a new place for `const val PLATFORM_TYPE_ID`
is required. It is logical to place it as a some kind of constant for Km node;
however, because it is platform-specific, there is a need for an empty
`KmFlexibleTypeUpperBound.Companion` in metadata common sources
and `public val KmFlexibleTypeUpperBound.Companion.PLATFORM_TYPE_ID`
extension in kotlin-metadata-jvm sources.

See also: KT-63156
2024-03-14 15:34:06 +00:00
Leonid Startsev 50331fb149 Remove all deprecated API from kotlin-metadata(-jvm).
This includes APIs such as:

- Visitors API
- Obsolete KotlinClassMetadata reading and writing API
- Extension and extension visitors API
- Flags and `class Flag` (a reduced version of it was moved to test sources)
- Various utility methods

Extensions mechanism got reworked with the removal of public visitors; it is
completely internal now with special accessors in kotlinx.metadata.internal
package.

Since `var KmClass.flags` is internal now (instead of being deprecated), special
utility functions with the name `_flagAccess` were added to internal package
for testing purposes.

^KT-63156 Fixed
2024-03-14 15:34:06 +00:00
Svyatoslav Scherbina e002f07ff5 [K/N][build] Fix distPlatformLibs Gradle task dependencies on Windows
K/N distPlatformLibs Gradle task dependended on hostInstall and
hostCache. The latter doesn't work (= has incorrect dependencies) on
hosts that don't support compiler caches for the host target (i.e.
Windows).
As a result, running distPlatformLibs task on Windows didn't work,
causing local test runs to fail.

This commit fixes the problem by making distPlatformLibs depend on
`"${hostName}PlatformLibs` instead, so it does the same as before but
handles the non-caching hosts correctly.
2024-03-14 13:08:12 +00:00
Artem Kobzar 75eeb5291d [K/JS] Add test for the private inner class bug ^KT-65657 2024-03-14 12:48:24 +00:00
Alexander Udalov 324d2e042a Tests: do not report backend diagnostics in diagnostic tests
There's a separate test data directory `testsWithJvmBackend` with a
runner that properly invokes the JVM backend and reports diagnostics
from it. All tests where JVM diagnostic presence/absence is important
were copied/moved there in this and previous commits.

The problem with the code removed in this commit is that it invoked some
parts of the _old JVM backend_ and old light classes, which is very far
from what users see in the production compiler at this point. This led
to real issues where we implemented incorrect behavior in K2 based on
the misleading diagnostic report from the K1 test.

The diagnostic in `triangleWithFlexibleTypeAndSubstitution4.kt` was
removed, but there's a copy of this test in `codegen/box/javaInterop`
which fails for K2 (KT-66529).

The diagnostic in `intersectionWithMappedSignature.kt` was removed and
that is OK because at this point CONFLICTING_JVM_DECLARATIONS there
seems like a bug in the old JVM backend.
2024-03-14 12:38:48 +00:00
Alexander Udalov 7d6cd8d126 Tests: remove diagnostic test with incorrect compiler behavior
In fact the latest compiler (neither K1 nor K2) does NOT report an error
here, see KT-66522. The error was there in the diagnostic test because
the test used custom code which invoked parts of the old JVM backend to
report signature clash errors.

The issue is rather minor and is present since 1.5, so to reduce
confusion, the test is deleted.

 #KT-66522
2024-03-14 12:38:48 +00:00
Alexander Udalov d986e0ee9c Tests: move more diagnostic tests to testsWithJvmBackend
In this commit, tests where backend diagnostics were reported correctly
are being moved.

FirScopeDumpHandler was added to FIR diagnostic tests with JVM backend
to support `SCOPE_DUMP` in `overridesBuiltinNoMagic.kt` and
`charAtAndOverload.kt`.
2024-03-14 12:38:48 +00:00
Alexander Udalov 56a1a3153b Tests: move inline class-related diagnostic tests
... with backend-reported diagnostics to testsWithJvmBackend.
2024-03-14 12:38:47 +00:00
Alexander Udalov d08c904b0c Tests: copy diagnostic test to codegen/box
This is basically a copy of the test
`diagnostics/tests/j+k/primitiveOverrides/triangleWithFlexibleTypeAndSubstitution4.kt`.
The diagnostic version of the test is not removed because it has
frontend-specific diagnostics `FIR_DUMP` and `SCOPE_DUMP`.

This test is copied to make it clear that it actually passes in K1, and
new errors in K2 here are technically a breaking change, see KT-66529.
The error CONFLICTING_INHERITED_JVM_DECLARATIONS was present there only
because diagnostic tests used parts of the old JVM backend to report JVM
backend diagnostics.

 #KT-66529
2024-03-14 12:38:47 +00:00
Alexander Udalov c997e9f142 Tests: move diagnostic test to testsWithJvmBackend
There's a difference in behavior of K1 and K2 here, see KT-66528.

 #KT-66528
2024-03-14 12:38:46 +00:00
Alexander Udalov 81a9f5654e Tests: remove diagnostic tests which are present elsewhere
- `typeParameterWithTwoBounds.kt` is already present in
  `diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/`.
- `clashWithCompanionObjectField.kt` is already present in
  `codegen/box/fieldRename/jvmFieldNoClash1.kt`.
- `jvmFieldAndJavaGetter.kt` is already present in
  `codegen/box/jvmField/noClashWithInheritedJavaMethod.kt`.

In case of two latter tests on JvmField, there's (correctly) no error
reported in JVM IR, which is why those are box tests.
2024-03-14 12:38:44 +00:00
Dmitriy Novozhilov c62fe0d107 [Test] Add regression test for KT-66336 2024-03-14 12:23:36 +00:00
Artem Olkov fcc4470b74 KT-65897: add exporting of kotlin constructors as Swift constructors #KT-65897 fixed
Merge-request: KT-MR-14734
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-03-14 12:21:39 +00:00
Alexander Shabalin bbcc5c9aed [K/N][tests] Migrate interopTest tests ^KT-61259 2024-03-14 11:47:00 +00:00
Kirill Rakhman c227e60150 [FIR] Fix resolution of LHS of augmented assignment operator call
Resolve it like a receiver of a call.
This makes the resolution result consistent with the equivalent
function call.

The K1 difference is covered by KT-66453.

#KT-66504 Fixed
2024-03-14 11:32:38 +00:00
Kirill Rakhman 609906a0b1 [FIR] Extract function for receiver resolution 2024-03-14 11:32:38 +00:00
Kirill Rakhman ff981a49ad [FIR] Make return types more precise 2024-03-14 11:32:38 +00:00
Kirill Rakhman 9f750d3036 [Tests] Reproduce current behavior of operator/infix resolution
#KT-66504
#KT-66453
#KT-58260
2024-03-14 11:32:38 +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
Nikita Bobko a8275c99a3 [FIR, IR] Check for strict subtypes during actualization
^KT-65775 Fixed
Review: https://jetbrains.team/p/kt/reviews/14906/timeline
2024-03-14 10:53:43 +00:00
Yan Zhulanow 0fec50135f [kotlin] Provide CFG facade for the extract function refactoring
This is the first implementation of a control flow graph facade for the
extract function IDE refactoring. The exact contents of
'KtDataFlowExitPointSnapshot' will be refined later.

^KT-65762 Fixed
2024-03-14 10:53:11 +00:00
Wojciech Litewka b032e647f7 [IR] Move assert in IrSetValueImpl to factory function
#KT-65773 In Progress
2024-03-14 10:41:52 +00:00
Wojciech Litewka 62f546ca0c [IR] Hide constructors of implementation classes behind factory functions
This is a step towards generating those classes. The code generator
won't care about default values in parameters,
and secondly, it will reorder some constructor parameters.
To keep source compatibility, new factory functions are created,
with the same signature as the constructor.
They will resist the change in order of constructor parameters.
Eliminating direct calls to constructors should also make further
refactorings a bit easier.

This change omits classes deriving from IrMemberAccessExpression,
as they are a bit more complicated
and will require separate effort.

#KT-65773 In Progress
2024-03-14 10:41:51 +00:00
Ivan Kochurkin b24d5390a8 [FIR] Use proper directOverriddenFunctions fun in FirNativeThrowsChecker
Fix false positive `INCOMPATIBLE_THROWS_OVERRIDE`

^KT-65105 Fixed

Merge-request: KT-MR-14937
Merged-by: Ivan Kochurkin <Ivan.Kochurkin@jetbrains.com>
2024-03-14 10:37:08 +00:00
Dmitriy Dolovov 4941094521 API 4 ABI: Dump WASM target names
We need to dump WASM target names exactly as we do it for Native target
names.

^KT-66367
2024-03-14 10:33:00 +00:00
Dmitriy Dolovov d43db973d4 API 4 ABI: Rename manifest property: wasm_target -> wasm_targets
^KT-66367
2024-03-14 10:33:00 +00:00
Dmitriy Dolovov 25de42b7eb API 4 ABI: Move const val KLIB_PROPERTY_WASM_TARGET to :kotlin-util-klib
^KT-66367
2024-03-14 10:33:00 +00:00
Aleksei.Glushko 651f068e06 [K/N] Fix a race on mark queue destruction in CMS GC
Merge-request: KT-MR-14076
2024-03-14 10:23:06 +00:00
Aleksei.Glushko fb7176d5fa [K/N] Checked ManuallyScoped
Merge-request: KT-MR-14076
2024-03-14 10:23:06 +00:00
Aleksei.Glushko 5396a6f8da [K/N] Avoid unitialized "fake" values
Do not use `char[sizeof(T)]` as an internal utility replacement for `T` (e.g. in intrusive_list::head_).
    It's UB to access members of such values before a propper constructor of T is called.

    Merge-request: KT-MR-14076
2024-03-14 10:23:06 +00:00
Yan Zhulanow 1f39bc9a18 [Analysis API] Add tests for foreign values 2024-03-14 10:20:29 +00:00
Yan Zhulanow 2dd16e1179 [Analysis API] Fix 'getContainingDeclaration()' for foreign values
Foreign values (such as '_DebugLabel' properties contributed by the
debugger) don't have a parent (or a valid source element in general).

^KTIJ-27382 Fixed
2024-03-14 10:20:29 +00:00
Yan Zhulanow 88a85b8936 [Analysis API] Add reference tests for containing declaration provider 2024-03-14 10:20:29 +00:00
Yan Zhulanow e171e21165 [Analysis API] Minor, remove duplicating check 2024-03-14 10:20:29 +00:00
Aleksandra.Arsenteva 83d0e1f447 [Test] KT-66152 Add tests for generic static function 2024-03-14 10:16:46 +00:00
cristiangarcia 8200cf404c Fix GitDownloadTask fails on windows
Required for KTI-1553
2024-03-14 09:19:37 +00:00
cristiangarcia 8dc460ae4a Fix CompileToExecutable CC issues
Required for KTI-1553
2024-03-14 09:19:37 +00:00
cristiangarcia 987f67e312 Fix CompileToExecutable CC issues
Required for KTI-1553
2024-03-14 09:19:37 +00:00
cristiangarcia 7693d9b9c4 KonanTest is not CC compatible
Required for KTI-1553
2024-03-14 09:19:37 +00:00
cristiangarcia 1e85233aab KonanDriverTest is not CC compatible
Required for KTI-1553
2024-03-14 09:19:37 +00:00
cristiangarcia bbbe5027f4 Postpone KonanCliCompilerRunner creation to workaround issues when consuming native dist
Required for KTI-1553
2024-03-14 09:19:37 +00:00