Commit Graph

110119 Commits

Author SHA1 Message Date
Johan Bay 612caf13cf [K/N] do not save klib hash in header caches
^KT-65443
2024-03-15 10:24:26 +00:00
Johan Bay 1f1522b787 [K/N] remove class field types from caches
^KT-65443
2024-03-15 10:24:26 +00:00
Johan Bay a481f35450 [K/N] deserialize inline functions for header klibs
For header klibs the indices in the cache for the function bodies
are wrong so we instead deserialize the inline functions up-front.
^KT-65443
2024-03-15 10:24:26 +00:00
Johan Bay 59f0c0464b [K/N] add flag to klib manifest for header klibs
^KT-65443
2024-03-15 10:24:26 +00:00
Johan Bay 1b521d564f [K/N] serialize field names to caches
^KT-65443
2024-03-15 10:24:26 +00:00
Johan Bay a89893a2c5 [K/N] add testing setup for header klibs and caches
^KT-65443
2024-03-15 10:24:26 +00:00
Johan Bay 84341a9e25 [K/N] add header_cache output type
^KT-65443
2024-03-15 10:24:25 +00:00
Roman Golyshev d8ae22e824 KTIJ-29015 [Plugin API] Add documentation to the ExtensionStorage.registerDisposable 2024-03-15 09:56:13 +00:00
Mikhail Glukhikh 40c4e865c7 K2/Java/enhancement: implement wildcards replacement with flexible bounds
This commit in fact changes two very related places:
- first, it implements forgotten 'enhancedForWarnings' in K2 enhancement
- second, it repeats KT-48515 fix for K2 while enhancing wildcards

#KT-65594 Fixed
Related to KT-48515, KT-63746
2024-03-15 09:40:54 +00:00
Mikhail Glukhikh 5b0cb5c9db K2/jspecify: reproduce KT-65594 2024-03-15 09:40:53 +00:00
Dmitriy Novozhilov 30e2af7b66 [FIR] Threat some error candidate applicabilities with same priority
There is a thing that `CandidateCollector` adds error candidate to the
  list of resulting candidates only if its applicability at least the
  same as current applicability of the collector

Also there is a problem, that deserialized symbol provider in CLI compiler
  and stub-based symbol provider in AA may return the same declarations
  in different order. This provokes the difference in the resulting set
  of candidates between the two modes:

```
val x by unresolved
```

During the resolution of this code compiler tries to find function `getValue`,
  and there are 6 of them in the stdlib. From them we are interseted in
  specific three:

1. `fun <K, V> Map<K, V>.getValue(key: R|K|): R|V|`
2. `inline operator fun <V, V1 : V> Map<in String, @Exact V>.getValue(thisRef: Any?, property: KProperty<*>): V1`
3. `inline operator fun <V, V1 : V> MutableMap<in String, out @Exact V>.getValue(thisRef: Any?, property: KProperty<*>): V1`

- (1) is inapplicable with `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
- (2) and (3) are inapplicable with `INAPPLICABLE_WRONG_RECEIVER`
- `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR` is more specific applicability than `INAPPLICABLE_WRONG_RECEIVER`
- CLI compiler always sees those functions in order 1 -> 2 -> 3
- AA providers sometimes returns them in order 2 -> 3 -> 1

So in CLI compilation candidates (2) and (3) are not added to the resulting
  set, as they are "less applicable" than (1), but in AA compilation they
  can be added to the set before (1), which causes sporadic change in
  FIR dump of `unsafeAssignmentExtra.kt`

To workaround this problem it was decided to treat `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
  and `INAPPLICABLE_WRONG_RECEIVER` applicabilities as "equally specific"

^KT-65218 Fixed
2024-03-15 08:21:42 +00:00
Alexander Shabalin d88092aa94 [K/N][tests] Migrate various runtime/ tests ^KT-61259 2024-03-15 01:28:01 +00:00
Sergej Jaskiewicz 7ad4e58a7a [FIR tree generator] Add a kDoc for FirUnitExpression 2024-03-14 23:19:40 +00:00
Sergej Jaskiewicz c379fd7fa1 [tree generator] Allow adding kDocs to implementation classes 2024-03-14 23:19:40 +00:00
Mikhail Glukhikh cd20f31810 K2: introduce JavaTypeParameterDefaultRepresentationWithDNN exp. feature
#KT-66447 Fixed
2024-03-14 22:39:03 +00:00
Christian Melchior 4464385fa9 Scripting: KT-62576 Remove irrelevant output from classpath debug information.
Merge-request: KT-MR-14868
Merged-by: Christian Melchior <christian.melchior@jetbrains.com>
2024-03-14 20:52:27 +00:00
Alevtina.Gamzikova 7d06b34bfa [Test] KT-64350 Add testcases 2024-03-14 20:41:53 +00:00
Jaebaek Seo 90ccdb79ed K2: Set special function kind to function param with receiver
`StubBasedFirTypeDeserializer` handles function parameter with a
receiver with a special exception, which sets it as
`ExtensionFunctionType`, but skips setting special function kinds for it
even when the function parameter type is a special function kind. This
drops `Composable` annotation from a lambda expression if the function
parameter taking the lambda expression as an argument has a receiver,
which causes a severe CodeGen error for Compose app on K2 Android
Studio.

^KT-66526 Fixed
2024-03-14 20:08:24 +00:00
Dmitriy Novozhilov cc6e0eb218 [Test] Unmute passing test about binary poisoning (KT-66551) 2024-03-14 19:53:25 +00:00
Dmitriy Novozhilov e89afe8f6b Advance bootstrap to 2.0.0-dev-18803 2024-03-14 19:53:25 +00:00
Timofey Solonin 9295f44eda Quote module name in the generated modulemap
This fixes an issue where Kotlin projects named "umbrella" or
"framework" produce unimportable framework modules.

^KT-66565
2024-03-14 19:19:57 +00:00
Timofey Solonin 4ab5c3b74b Record unquoted module name behaviour in KGP-IT
^KT-66565
2024-03-14 19:19:57 +00:00
Artem Daugel-Dauge 06960394b7 [Gradle] Fix issues with EmbedAndSignUsedWithPodDependencies diagnostic
Emit diagnostic right after task graph had been formed instead of waiting for embedAndSign execution

(^KT-66445,^KT-66446) Verification Pending
2024-03-14 18:40:16 +00:00
Sergej Jaskiewicz 9851ff1905 [FIR] Reproduce KT-66277, KT-66279, KT-66512 and KT-66534 2024-03-14 18:34:30 +00:00
Dmitrii Gridin b3827947d9 [Analysis API] Update KDoc for KtPsiTypeProvider#asKtType 2024-03-14 18:05:15 +00:00
Dmitrii Gridin 5689dedea0 [Analysis API FIR] KtFirPsiTypeProvider: drop redundant TODO
Regular type annotations work as expected

^KT-62351 Obsolete
2024-03-14 18:05:15 +00:00
Dmitrii Gridin ba421aa320 [Analysis API FIR] KtFirPsiTypeProvider: support type parameter position in asKtType
^KT-66530
2024-03-14 18:05:15 +00:00
Dmitrii Gridin 675bf36049 [FIR] JavaTypeParameterStack: allow nullable return from get
It is not always possible to have the correct mapping,
at least on the Analysis API side

^KT-66530 Fixed
2024-03-14 18:05:15 +00:00
Artem Kobzar eb8054ac1e [K/Wasm] Fix object optimization false trigger on non-pure objects ^KT-66471 Fixed 2024-03-14 17:12:45 +00:00
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