Commit Graph

109329 Commits

Author SHA1 Message Date
Alexander Shabalin b2d957b990 [K/N] Extract RunLoopSource ^KT-63423 2024-01-17 18:26:00 +00:00
Alexander Shabalin 2dd7a9ef21 [K/N] Support CF objects in ObjectPtr ^KT-63423 2024-01-17 18:26:00 +00:00
Alexander Shabalin e5269daa74 [K/N] Constructor of ObjectPtr with retain ^KT-63423 2024-01-17 18:26:00 +00:00
Alexander Shabalin c4992f1912 [K/N] Move AutoreleasePool into objc_support ^KT-63423 2024-01-17 18:26:00 +00:00
Alexander Shabalin 815b452435 [K/N] Remove old release-on-main ^KT-63423 2024-01-17 18:26:00 +00:00
Alexander Shabalin eb0bd0112a [K/N] Add a stress test on dispose-on-main ^KT-63423 2024-01-17 18:26:00 +00:00
Dmitriy Novozhilov 0741250b12 [FIR] Use proper FirProvider in the FirKLibSerializerExtension
3aa84906 changed native metadata serialization to use proper platform
  session, but it caused a new bug: FirKLibSerializerExtension uses
  FirProvider from the passed session to get a containing file of
  serialized declaration to put some extension into the metadata. And
  platform session doesn't contain information about any declarations
  except platform ones

So it's needed to use the proper FirProvider in it, which can be
  extracted from Fir2IrComponents. This provider contains providers from
  all sessions that are being compiled plus providers for top-level
  declarations generated by compiler plugins

^KT-65024 Fixed
2024-01-17 17:38:44 +00:00
Evgeniy.Zhelenskiy 70d1a2ea8c [FIR] Report package usages as a LHS
#KT-59972
2024-01-17 17:28:46 +00:00
Mikhail Glukhikh e999e289ee K2: split EXPLICIT_TYPE_ARGUMENTS_IN_PROPERTY_ACCESS to property/objects
Related to KT-64982
2024-01-17 16:51:48 +00:00
Mikhail Glukhikh 4fd73b06e2 FIR: render FirErrorResolvedQualifier properly 2024-01-17 16:51:48 +00:00
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