Commit Graph

108019 Commits

Author SHA1 Message Date
Mikhail Glukhikh 581cac3d45 K2: report EXPLICIT_TYPE_ARGUMENTS_... also on resolved qualifiers
#KT-64982 Fixed
2024-01-17 16:51:48 +00:00
Mikhail Glukhikh ee515ec5c4 K2: drop TODO in buildResolvedQualifierForClass
#KT-59649 Fixed
2024-01-17 16:51:48 +00:00
Mikhail Glukhikh caa850e470 FIR: render resolved qualifier type arguments in dumps 2024-01-17 16:51:48 +00:00
Mikhail Glukhikh 0a21669fb9 K2: reproduce KT-64982 2024-01-17 16:51:48 +00:00
Brian Norman 8f9bb75e60 [FIR] Allow identity equality to be used in contract implications
^KT-63256 Fixed
2024-01-17 14:59:59 +00:00
Roman Efremov ee1ee965a1 [FIR] Fix incorrect work of K2 expect-actual matcher when actual is Java
...field, which is fake override.
This was failing in Stdlib with `expect HashMap` + actual typealias to
`java.util.HashMap`.

^KT-63624 Fixed
2024-01-17 14:47:41 +00:00
Roman Efremov 3d2a37ee41 [Test] Write reproducer test for expect-actual matching to Java field
..., which comes from super class, which incorrectly works in K2.

^KT-63624
2024-01-17 14:47:41 +00:00
Roman Golyshev bb044bb57e [docs] Improve formatting in JavaToKotlinClassMap docs
Add `-` symbols to form a proper list
2024-01-17 14:28:35 +00:00
Nikita Bobko 0dc8629312 [FIR] Don't report MUST_BE_INITIALIZED on private open properites
^KT-59074 Fixed

This solution is not ideal. Ideally, the allopen compiler plugin
shouldn't report `private` properites as `open` KT-64980, but it will
unpredictably break other things.
2024-01-17 14:18:06 +00:00
Alexander Udalov 35caae355d Tests: minor, add box test for KT-31367/KT-61805
For some reason, codegen box test was not added in 082c337faa. The main
point of it now is to check that everything works correctly in the
IrFakeOverrideBuilder mode.
2024-01-17 12:27:36 +00:00
Pavel Kunyavskiy 15094eb03a [IrFakeOverrideBuilder] Support fake overrides for java static methods
^KT-64150
2024-01-17 11:40:12 +00:00
Dmitriy Dolovov 8f046d36e0 [FIR2IR] Implement support for Fir2IrLazyTypeAlias
Fir-based lazy type alias is required in IR text tests to check that
lazily loaded IR is equivalent to deserialized IR (module bodies)
and does not cause ABI compatibility issues in KLIB-based backends.

^KT-65033
2024-01-17 11:37:48 +00:00
Nikolay Lunyak 96db6eb94f [FIR] Support tailrec safe-calls
^KT-63529 Fixed
2024-01-17 11:31:26 +00:00
Nikolay Lunyak a4b7697714 [FIR] Reproduce KT-63529
^KT-63529
2024-01-17 11:31:26 +00:00
Dmitriy Novozhilov 9d0f17da26 Advance bootstrap to 2.0.0-dev-12830 2024-01-17 11:29:29 +00:00
Rafał Galczak c7d4a7e1f1 Add support for serializing kotlin.time.Duration in Parcelize plugin.
This commit adds support for the Parcelize plugin to generate default
serialization implementation for the kotlin.time.Duration. As Parcelize
already supports serializing some of the kotlin library types it makes
sense to support more common ones for the user convenience.

https://issuetracker.google.com/issues/264614661
2024-01-17 11:24:26 +00:00
Alexander Kuznetsov b828365bb5 ReflectiveAccess: find the exact class the field is declared in
Affects IR Evaluator in IDEA.

The problem is happening because
`ReflectiveAccessLowering#fieldLocationAndReceiver` returns the class
 the field was called on, not the class the field was declared in.

 Then the class is used for obtaining a field by using reflection's
 `getDeclaredField` to make the field accessible after.
 But `getDeclaredField` doesn't work for field declared in a superclass,
 hence the error.

#KT-65012 fixed


Merge-request: KT-MR-13919
Merged-by: Alexander Kuznetsov <Aleksander.Kuznetsov@jetbrains.com>
2024-01-17 11:04:33 +00:00
Artem Kobzar dfe2d8651e [K/JS] Prepare JS Plain Objects plugin to publication 2024-01-17 10:52:58 +00:00
Alexander Korepanov 561be747c1 [JS FIR Tests] Add multimodule order test for FIR
^KT-64451 Fixed
2024-01-17 10:32:46 +00:00
Alexander Korepanov b672e5c131 [JS FIR Tests] Add source map smoke test for FIR
^KT-64450 Fixed
2024-01-17 10:32:46 +00:00
Roman Golyshev 6884266328 KTIJ-27841 [AA] Add explicit containingFile to ElementsToShortenCollector
This simplifies the code in a few places, and also allows to avoid
retrieving the `containingKtFile` from the PSI elements
2024-01-17 10:15:28 +00:00
Roman Golyshev 646cdb56e5 KTIJ-27841 [AA] Do not import and shorten class constructor if it will alter other references in the file
N.B. This implementation does not 100% prevent conflicts or resolve
alterations when shortening functions.
To guarantee that,
we would need to carefully consider all the references in the file,
and to check whether they have changed their resolve in the presence
of a new import.
This is not trivial and will be approached separately under a different
task.

^KTIJ-27841 Fixed
2024-01-17 10:15:28 +00:00
Roman Golyshev 1e2f612cbc KTIJ-27841 [AA] Add simple test cases for the classes with same name conflicts 2024-01-17 10:15:28 +00:00
Roman Golyshev 0e244b3fbf KTIJ-27841 [AA] Introduce intermediate ElementsToShortenCollector.importBreaksExistingReferences
This clarifies the semantics a little bit
2024-01-17 10:15:27 +00:00
Roman Golyshev 702be98927 KTIJ-27841 [AA] Refactor ElementsToShortenCollector.processCallableQualifiedAccess
Rename it, and return `ElementToShorten` from it
2024-01-17 10:15:26 +00:00
Roman Golyshev d0d29bea57 KTIJ-27841 [AA] Refactor ElementsToShortenCollector.findClassifierQualifierToShorten
Extract the cycle body into a separate function for clarity
2024-01-17 10:15:26 +00:00
Vladimir Sukharev 48df87f635 [K/N][Tests] Migrate two more cinterop tests
^KT-61259
2024-01-17 08:33:41 +00:00
Aleksei.Cherepanov 1e7e42baf2 [JPS] Improve JPS dumb mode
For the correct work of the compiler, some maps should be fulfilled by the build system. In the first implementation of dumb mode for JPS all maps were disabled. Now flag was introduced to determine IC behavior: to collect data needed for the compiler's code generation and disable maps and IC analysis

^KT-65043 Fixed
2024-01-17 08:22:27 +00:00
Aleksei.Cherepanov 32bc2b55ed Show compiler error in diff if JPS IC test fails 2024-01-17 08:22:27 +00:00
Kirill Rakhman 0cebf2b39f [Tests] Remove irrelevant code from test 2024-01-17 08:20:06 +00:00
Kirill Rakhman 00491a78f1 [FIR] Implement canBeNull for captured type by checking its supertypes
#KT-62959
2024-01-17 08:20:06 +00:00
Kirill Rakhman 7b0c4e5bf6 [FIR] Adapt assertion after #KT-62959 2024-01-17 08:20:06 +00:00
Kirill Rakhman ec78747f2b [Tests] Add test for #KT-62956 2024-01-17 08:20:06 +00:00
Kirill Rakhman 9d91eb2510 [FIR] Fix inference based on recursive upper bound
#KT-59012 Fixed
2024-01-17 08:20:06 +00:00
Kirill Rakhman 251827c9aa [FIR] Don't approximate captured types
This fixes some type argument mismatch errors caused by a captured type
being approximated and then captured again.
Some places need to be adapted to work with captured types that
previously only worked with approximated types.

#KT-62959 Fixed
2024-01-17 08:20:05 +00:00
Kirill Rakhman b6d7f35ebf [FIR] Implement capturing of captured types
This is in preparation of a future commit, where captured types won't be
approximated anymore after completion.

Consider a case like

class Box<T>(val value: T)
interface Foo<T> { fun bar() }

fun test(x: Box<out Foo<*>>) {
    x.value.bar()
}

The type of `x.value` will be `CapturedType(out Foo<*>)`.
Note that capturing only applies to the top level, i.e., nested
projections are not captured.
That's why it becomes necessary to support capturing of captured types,
otherwise the star projection in `CapturedType(out Foo<*>)` is not
properly captured in the receiver of the call `x.value.bar()`.

#KT-62959
2024-01-17 08:20:04 +00:00
Mikhail Glukhikh 3c20a7b82a K1/K2: add test for KT-62959 2024-01-17 08:20:04 +00:00
Roman Golyshev 67d32c3072 KT-64993 [AA] Unwrap safe call when deducing the expected type of function argument in KtFirExpressionTypeProvider
^KT-64993 Fixed
2024-01-16 22:36:59 +00:00
Roman Golyshev 318fd52567 KT-64993 [AA] Add test case for expected type in unsafe call arg 2024-01-16 22:36:59 +00:00
Roman Golyshev 72a0f2023d KT-64988 [AA] Unwrap safe call when resolving named arguments in FirReferenceResolveHelper
^KT-64988 Fixed
2024-01-16 22:36:59 +00:00
Vladimir Sukharev 80cf88c9b9 [K/N][Tests] Move threadStates tests to common codegen/box folder
^KT-61259
2024-01-16 20:15:25 +00:00
Sergey.Shanshin 96d7dc4fa6 [KxSerialization] Fixed access private custom serializer on property
When a custom serializer is specified on a type and this type is used in a property of another serializable class, then on the JVM this leads to an error accessing the custom serializer class - because it is private and located in another package.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2495


Merge-request: KT-MR-12877
Merged-by: Sergei Shanshin <Sergey.Shanshin@jetbrains.com>
2024-01-16 20:04:17 +00:00
wrongwrong ab76f94aa7 Reflection: minor, fix obsolete comment
InlineAwareCaller has already been renamed.
2024-01-16 20:03:58 +00:00
Vladimir Tagakov ad9c100137 Sort class members in jvm-abi-gen
#KT-64589 Fixed
2024-01-16 20:03:29 +00:00
Alexander Udalov 1a46b053f2 jvm-abi-gen: minor, refactor debug info and body removing visitors
Co-authored-by: Vladimir Tagakov <vtagakov@lyft.com>
2024-01-16 20:03:29 +00:00
Pavel Kunyavskiy 2bf5a58a30 [Fir2Ir] Don't use FirSyntheticProperty as the cache key
^KT-64871
2024-01-16 19:14:52 +00:00
Mikhail Glukhikh c3c215b6a4 CallableId: return pathToLocal to constructor (KT-58739) 2024-01-16 18:26:41 +00:00
Sergej Jaskiewicz 731eeb020d [JVM] Don't rely on presence of signatures in JVM IR serialization tests
This patch should not change any reasonable testing behavior. The only
case when the behavior could be changed is when two different functions
have the same IdSignature, which is a problem on its own.

Required for KT-64809
2024-01-16 18:25:58 +00:00
Alexander Shabalin 7d35c1087e [K/N] Make GlobalData be initialized lazily ^KT-64313 2024-01-16 16:54:58 +00:00
Anastasia.Nekrasova 7429dd4b94 K2: Support for inter-module interaction for @SubclassOptInRequired
The inter-module interaction was partially supported, but the
DiagnosticCompilerTestFE10TestdataTestGenerated and
LFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated were
failing. This is because the arguments of annotations were not fully
resolved in loadExperimentalitiesFromAnnotationTo function.

^KT-60262 Fixed
2024-01-16 16:53:04 +00:00