Commit Graph

109329 Commits

Author SHA1 Message Date
cristiangarcia 1847485d28 Make maven publishing CC compatible
Required for KTI-1553
2024-02-23 18:27:11 +00:00
Pavel Kunyavskiy c991535756 [IRFakeOverrides] Fix accessors visibilities
^KT-65801
2024-02-23 16:35:27 +00:00
Sergej Jaskiewicz acee8da283 [IR] Move coroutine-related helpers to a more appropriate place
The `isBuiltInSuspendCoroutine` and
`isBuiltInSuspendCoroutineUninterceptedOrReturn` helpers are not
inherently related to function inlining.
2024-02-23 16:26:55 +00:00
Sergej Jaskiewicz 919abe483a [JVM IR] Move CachedSyntheticDeclarations to backend.common
This will allow us to use this class in KLIB-based backends (KT-64865)
2024-02-23 16:26:55 +00:00
Sergej Jaskiewicz 25be39dcc6 [JVM IR] Factor out JVM-specific logic from CachedSyntheticDeclarations
This will allow us to use this class in KLIB-based backends (KT-64865)
2024-02-23 16:26:55 +00:00
Sergej Jaskiewicz d137594c77 [JVM IR] Remove JvmLoweredDeclarationOrigin.SYNTHETIC_MARKER_PARAMETER
There is already a similar origin
`IrDeclarationOrigin.DEFAULT_CONSTRUCTOR_MARKER`
2024-02-23 16:26:55 +00:00
Sergej Jaskiewicz 4325803262 [JVM IR] Move SYNTHETIC_ACCESSOR origin to IrDeclarationOrigin.Companion
We want to generate synthetic accessors not only on JVM (KT-64865),
so this is one of the prerequisites.
2024-02-23 16:26:55 +00:00
Sergej Jaskiewicz 86587a3bf2 [JVM IR] Add KDocs for methods related to synthetic accessor generation 2024-02-23 16:26:55 +00:00
Sergej Jaskiewicz 524dd6794a [JVM IR] Use KDoc in JvmSymbols i/o regular comments when possible 2024-02-23 16:26:55 +00:00
Sergej Jaskiewicz 4f44d32cc2 [JVM IR] Avoid hard-coded checks for coroutine intrinsics
Use existing helpers for that instead, and introduce a new one.
2024-02-23 16:26:55 +00:00
Dmitriy Novozhilov ebeba231a0 [FIR2IR] Slightly cleanup FakeOverrideGenerator 2024-02-23 16:26:05 +00:00
Dmitriy Novozhilov ef8f954586 [FIR2IR] Part 7. Don't use IdSignature for code fragments
Related to KT-64990
2024-02-23 16:26:05 +00:00
Dmitriy Novozhilov 7aa99a97d9 [FIR2IR] Part 6. Delete FirIrProvider
`IrProvider`s are used to bind unbound symbols which are left after IR
  construction. fir2ir doesn't leave any unbound symbols in the tree,
  so there is actually no need in FirIrProvider at all
2024-02-23 16:26:05 +00:00
Dmitriy Novozhilov aba1e587c4 [FIR2IR] Part 5. Cleanup Fir2IrClassifierStorage API (type aliases) 2024-02-23 16:26:05 +00:00
Dmitriy Novozhilov fb4b14e250 [FIR2IR] Part 4. Cleanup Fir2IrClassifierStorage API (enum entries)
^KT-65937 Fixed
2024-02-23 16:26:05 +00:00
Dmitriy Novozhilov e340286606 [FIR2IR] Part 3. Don't create type parameter symbols with signature
^KT-64990
2024-02-23 16:26:05 +00:00
Dmitriy Novozhilov d0c9353d41 [FIR2IR] Part 2. Don't create class symbols with signature
Signature calculation was already disabled for almost all cases in the
  scope of KT-64990
2024-02-23 16:26:05 +00:00
Dmitriy Novozhilov 9c21c2214a [FIR2IR] Part 1. Cleanup Fir2IrClassifierStorage API (classes)
This commit cleans up API related to referencing classes and their symbols,
  to make it more similar with similar API in Fir2IrDeclarationStorage
2024-02-23 16:26:05 +00:00
Dmitriy Novozhilov 3bf0a11ced [Test] Reproduce KT-65937 2024-02-23 16:26:05 +00:00
Evgenii Mazhukin cc2dcf0078 [JPS][IC] Register lookups as usages in jps dependency graph
^KT-65429 In Progress


Merge-request: KT-MR-14485
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2024-02-23 16:08:29 +00:00
Sebastian Sellmair 85cfa252c3 [CODEOWNERS] Add 'Kotlin in Fleet' as codeowner for ':kotlin-tooling-core' 2024-02-23 15:48:47 +00:00
Sebastian Sellmair d80e6f8d66 [kotlin-tooling-core] Implement 'closure' sequence APIs 2024-02-23 15:48:47 +00:00
Artem Kobzar be47632609 [K/JS] Optimize logical operators generating 2024-02-23 15:16:31 +00:00
Vladimir Sukharev 425381ddf9 [K/N][Tests] Improve test UX for wrong combination of OPT and CACHE modes 2024-02-23 15:06:16 +00:00
Kirill Rakhman 3aab97eb7c Update generated files by IDEA 2024-02-23 14:29:33 +00:00
Kirill Rakhman 4780bb90e7 [FIR] Fix mapping of java annotation arguments when parameter is array
#KT-65933 Fixed
2024-02-23 14:01:16 +00:00
Dmitriy Novozhilov 6479b15e46 [Test] Add regression test for KT-65493 2024-02-23 12:16:12 +00:00
Nikolay Lunyak 35b172c40f [FIR] Ensure KT-65581 is non-reproducible
It seems it was briefly introduced at
and then present at `2.0.0-dev-14408`,
but no longer is at `2.0.0-dev-16490`

^KT-65581 Obsolete
2024-02-23 11:52:13 +00:00
Ivan Kochurkin 1e388ad7dc [FIR2IR] Remove non-existent accessors from property references on Java fields
Rename `MissingFieldInJavaClass.kt` to `FieldsFromJavaClass.kt` to correspond its content

^KT-65722 Fixed
2024-02-23 11:22:44 +00:00
Roman Golyshev c1ea878e52 KT-64808 [stubs] Add extra tests for synthethic declarations from data and value classes
It's not related to the stubs format changes, but there were no tests
for that in symbols resolve tests
2024-02-23 10:51:28 +00:00
Roman Golyshev 47aa6392bf KT-64808 [stubs] Materialize all synthethic declarations in Kotlin Stubs
Here is the reasoning behind that change:

Historically, all the declarations generated by compiler plugins
were marked with `SYNTHESIZED` member kind in Kotlin Metadata
by K1 compiler.

In K1 IDE, descriptors were deserialized directly from the Kotlin
Metadata, and they saw all the generated declarations from it.

In the stubs, however, such declarations were not materialized at all.
It caused no troubles, since K1 IDE relied on descriptors to get the
essential resolution information in completion and other subsystems.
So, the resolution of members from jars processed
by compiler plugins (e.g. `kotlinx-serialization-json`) was mostly fine.

In K2 IDE, however, we use stubs to "deserialize" FIR declarations from
them, to later create `KtSymbol`s upon that FIR.

If we see a library file which was processed by compiler plugins, we
build stubs for it based on the Kotlin Metadata, and then use stubs to
create FIR.
But if stubs do not contain information about the generated
declarations,
then the resulting FIR will also not contain such declarations.

In the end, the K2 IDE would also be blind to such declarations, since
there is no other way to retrieve them from the library jar.

By meterializing all the synthethic declarations in stubs (with some
minor exceptions for data classes), we would avoid such problems,
and the resolve of such declarations from compiler jars in
K2 IDE would become possible.

Important note: currently, the Kotlin Metadata format between K1 and K2
frontends is not 100% the same; most notably, in K2, the generated
declarations are marked as regular declarations,
not as `SYNTHESIZED` ones.

Hence, if you compile a jar with the current version of K2 frontend,
then all the generated declarations would have a regular `DECLARATION`
origin, and there would be no such issues as described above.

There are two notes here:

1. K2 IDE still has to support the jars compiled by the K1 compiler,
so it still makes sense to alter the stubs and make the generated
declarations visible.
2. The issue about the different stub formats has been reported
(see KT-64924), and might be resolved in the future.
So it is possible that K2 frontend's metadata will also start
marking the generated declarations as `SYNTHESIZED`.

^KT-64808 Fixed
2024-02-23 10:51:28 +00:00
Roman Golyshev 59b74f10aa KT-64808 [stubs] Small refactoring of CallableClsStubBuilder
Rename `shouldSkip` to `mustNotBeWrittenToStubs`, so it looks more
in line with `mustNotBeWrittenToDecompiledText` in the decompiler
2024-02-23 10:51:27 +00:00
Alexander Udalov 555b35d894 Minor, add regression test for KT-62788 2024-02-23 09:02:03 +00:00
Sebastian Sellmair 6b6808d87c [ObjCExport] ObjCType: Implement HasExtras instead of HasMutableExtras
... to enforce the immutability concept of this entities.

KT-65891 Fixed
2024-02-23 07:31:32 +00:00
Sebastian Sellmair 704379934e [kotlin-tooling-core] Allow nullable extra values
The change is binary compatible, but not source compatible.
Potential clients like Google might need to adapt
a potential `IdeaKotlinExtrasSerializationExtension` implementaiton.

Right now, no such implementation is known
2024-02-23 07:31:32 +00:00
Sebastian Sellmair 622a88ff26 [ObjCExport] Translate ObjCObject types, respecting the @ExternalObjCClass annotation
KT-65891 Fixed
2024-02-23 07:31:32 +00:00
Sebastian Sellmair a5baf42422 [ObjCExport] KtObjCExportHeaderGenerator: Separate 'requiresClassForwardDeclaration' from ObjCType.classId
There are two different objectives associated with this newly
introduced extras:

- originClassId: Used to track where a type came from; Will
ensure that the translation queue will be populated to also
translate potential dependency classes

- requiresForwardDeclaration: Used to track if a certain
type requires rendering as forward declaration

KT-65891
2024-02-23 07:31:32 +00:00
Ilya Gorbunov 85854a6b8d [stdlib] Make enumEntriesIntrinsic not reified/inline
It's required to simplify the corresponding backends' inliners.

KT-59712, KT-59713
2024-02-23 05:50:37 +00:00
Ilya Gorbunov 86d5e83f4b [stdlib] Remove bootstrap implementation of enumEntriesIntrinsic
It should have been already implemented as intrinsic in all backends.

Do not test enumEntries intrinsic in the old JVM BE.

KT-53154

Co-authored-by: Alexander Udalov <alexander.udalov@jetbrains.com>
2024-02-23 05:50:37 +00:00
Vladimir Sukharev 947b825d77 [K/N][Tests] Ignore test kt56402 with caches
^KT-66032
2024-02-22 22:41:37 +00:00
Vladimir Sukharev ecdf97c6b7 [K/N][Tests] Adjust test smoke.kt to improved fake override engine
^KT-61323
2024-02-22 22:41:37 +00:00
Vladimir Sukharev 98c3147d19 [K/N][Tests] Fix ComplexCInteropTest.kt to respect 2-stage compilation
^KT-66014
2024-02-22 22:41:37 +00:00
Dmitriy Dolovov 5e81850bb1 [KLIB tool] Don't sort declarations in "dump-metadata" command
Instead, let the command print declarations in the program order.
Do sorting only in special "test mode".

^KT-62340
2024-02-22 22:21:30 +00:00
Dmitriy Dolovov d70dd7808b [kotlinp] Fix: Forgotten sorting of KmClasses in KlibKotlinp
The declarations that are printed by the kotlinp tool may be optionally
sorted. That's controlled by `sortDeclarations` flag in
`org.jetbrains.kotlin.kotlinp.Settings`. However, there was no sorting
implemented for `KmClass`es.

This commit fixes that.

^KT-62340
2024-02-22 22:21:30 +00:00
Alexander Shabalin edf8dc0421 [K/N] Add xcodeOverride to Xcode in native-utils ^KTI-1553
- findCurrent() is used by the build of Kotlin/Native compiler itself.
  It happens indirectly, via AppleConfigurables.
- CurrentXcode invokes xcrun command line tool in its implementation.
- Configuration cache prohibits calling external commands

All three factors combined make K/N compiler build incompatible with CC.

By using xcodeOverride, K/N compiler build can provide its own Xcode
instance avoiding calling external commands when it's not allowed by CC.
2024-02-22 21:22:36 +00:00
Yahor Berdnikau 1d9129f688 [Gradle] Bump max Gradle version in tests to 8.6
^KT-64378 Verification Pending
2024-02-22 19:01:29 +00:00
Andrey Yastrebov 9d30fb1b1c KT-65741 Fix SIR visitor parameter name & fix typo 2024-02-22 18:46:01 +00:00
Andrey Yastrebov d76a6d6a9c KT-65741 Add Swift Export KGP tasks 2024-02-22 18:46:01 +00:00
Ilya Goncharov eabd2f0fc7 [Gradle, Wasm] Fix mismatch report message for upgradeLockFile
^KT-65870 fixed
2024-02-22 18:33:46 +00:00
Dmitriy Dolovov 8365915b3f [Commonizer] Metadata comparator: Proper comparison of type lists
There are two types of type lists that can be met in Kotlin metadata
and that should be treated in a different way:

1. The order-sensitive type list. Examples: Context receivers.
2. The order-insensitive type list. Examples: Class supertypes,
   type parameter upper bounds.

With (1) swapping elements in list causes source and/or ABI
incompatibility, while with (2) it does not. If it happens that we
compare two type lists in Kotlin metadata of (2) kind, we should group
them using the key computed with the help of
`dumpToString(dumpExtras = false)` instead of just the index as we do
in case of (1).

^KT-62753
2024-02-22 17:53:15 +00:00