Commit Graph

109155 Commits

Author SHA1 Message Date
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
Dmitriy Dolovov 40af02ca4f [Commonizer] Metadata comparator: A special path element for FlexibleTypeUpperBound
^KT-62753
2024-02-22 17:53:15 +00:00
xiaozihan.larryxiao cabd9ad1ec IR: Fix missing source in IrClass with DeepCopyIrTreeWithSymbols
When using DeepCopyIrTreeWithSymbols as class transformer to transform
the IrClass, the source element of IrClass was set to
SourceElement.NO_SOURCE after the transform.

^KT-65343 Fixed
2024-02-22 16:14:38 +00:00
Nikita Bobko 7924573d20 [FIR] Report redeclaration across KMP source sets
^KT-57585 Fixed

Related tests:
- MultiPlatformIntegrationTestGenerated.testSimpleNoImplKeywordOnTopLevelFunction
- MultiPlatformIntegrationTestGenerated.testWeakIncompatibilityWithoutActualModifier
- FirPsiJsKlibDiagnosticsTestGenerated.testSignatureClash_MPP
- LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated$ResolveWithStdlib$MultiModule.testFakeOverrides
- DiagnosticCompilerTestFE10TestdataTestGenerated$Tests$Multiplatform:
- LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated$Tests$Multiplatform
- FirOldFrontendMPPDiagnosticsWithPsiTestGenerated
- FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated
- FirLibraryModuleDeclarationResolveTestGenerated.testDataClass
- org.jetbrains.kotlin.idea.k2.highlighting.K2HighlightingMetaInfoTestGenerated$Diagnostics.testDataClassFromLibrary
- org.jetbrains.fir.uast.test.FirLightClassBehaviorTest.testContainingFile
- org.jetbrains.fir.uast.test.FirLightClassBehaviorTest.testAnnotationParameterReference
- org.jetbrains.uast.test.kotlin.org.jetbrains.uast.test.kotlin.comparison.FE1LightClassBehaviorTest.testContainingFile
2024-02-22 16:06:36 +00:00
Nikita Bobko 4120d6a8aa [FIR] Search expect for actual only in dependsOn dependencies
Before this commit, the expect-actual resolver could find expects in
regular dependencies

Note: The appeared `VIRTUAL_MEMBER_HIDDEN` in
compiler/fir/analysis-tests/testData/resolveWithStdlib/multiModule/FakeOverrides.kt
isn't caused by my change. It's caused by fixing the testData dependency
syntax notation.

The testData improperly used regular dependency syntax notation, while
it should have been using dependsOn

Before:
    Regular dependency syntax notation

    // MODULE: androidMain(commonMain)

After:
    dependsOn dependency syntax notation

    // MODULE: androidMain()()(commonMain)
2024-02-22 16:06:35 +00:00
Dmitriy Novozhilov e431a96897 [FIR2IR] Properly calculate overridden functions for lazy fake overrides
For detailed explanation see the comment to `computeBaseSymbolsWithContainingClass`
  function in `FakeOverrideGenerator.kt`

^KT-65592
2024-02-22 15:56:57 +00:00
Vladimir Sukharev 1761c8eb25 [K/N][Tests] Ignore test sourceBinarySource.kt for per-file-caches on Linux
^KT-65669
2024-02-22 14:57:15 +00:00
Alexander Shabalin c600b74459 [K/N][tests] Restore ir_providers/hello.kt ^KTI-1597 2024-02-22 14:56:13 +00:00
Alexander Shabalin dc4f12f29c Revert "[K/N][Tests] Migrate driver test llvm_variant_dev"
This reverts commit d8a90f55a8.
2024-02-22 14:56:13 +00:00
Alexander Shabalin 4765cfda53 Revert "[K/N][Tests] Migrate test override_konan_properties0"
This reverts commit 9ef051dbc5.
2024-02-22 14:56:13 +00:00
Alexander Shabalin 8518c3f54f Revert "[K/N][Tests] Migrate test override_konan_properties0 and add testDriverVersion"
This reverts commit fbe8db4b45.
2024-02-22 14:56:13 +00:00
Alexander Shabalin 876be8f17a Revert "[K/N][Tests] Ignore KonanDriverTest tests on MinGW/opt.debug/cache.no"
This reverts commit 313b230333.
2024-02-22 14:56:13 +00:00
Ilya Goncharov bca785a87c [Gradle, Wasm] Fix copying wasm file to destination dir
^KT-65889 fixed
2024-02-22 14:53:54 +00:00
Yahor Berdnikau 6b19b8b9d0 [Repo] Don't use kotlinOptions in repo build scripts
^KT-63419 In Progress
2024-02-22 14:48:10 +00:00
Yahor Berdnikau 22e1e79c41 [Repo] Don't use kotlinOptions in buildSrc-compat
Exception is configuring klib relative path which should be fixed via
separate issue.

^KT-63419 In Progress
2024-02-22 14:48:10 +00:00
Igor Yakovlev eea3c3624c [WasmJs] Generate a wrapper that run in Deno
Fixed #KT-65713
2024-02-22 14:45:09 +00:00
Ivan Kylchik 96b5d47e68 [IR] Move property needsInlining into InlineFunctionResolver
#KT-64807 Fixed
2024-02-22 09:55:58 +00:00
Ivan Kylchik 9e7ddfa191 [IR] Resolve fake overrides inside getFunctionDeclaration function
#KT-64807
2024-02-22 09:55:58 +00:00
Ivan Kylchik 2bfd1c8f23 [IR] Don't pass originalCallee to the inliner
`originalCallee` is supposed to be the owner of the original call.
It can be a fake override, and in the inliner we are using actual
function with body. Apparently we can just stick with the resolved
function.

#KT-64807
2024-02-22 09:55:58 +00:00
Ivan Kylchik 0258927d33 [IR] Forbid to use shouldExcludeFunctionFromInlining as public API
#KT-64807
2024-02-22 09:55:58 +00:00
Ivan Kylchik f1bc542d74 [IR] Change the return type of getFunctionDeclaration to be nullable
#KT-64807
2024-02-22 09:55:58 +00:00
Ivan Kylchik 91f818ba5a [IR] Transformed InlineFunctionResolver into abstract class
#KT-64807
2024-02-22 09:55:58 +00:00
eugene.levenetc 30b63e4843 [ObjCExport] Add translation of functions and properties extensions
KT-65630
2024-02-22 09:20:12 +00:00
Aleksei.Cherepanov a34b87c63a Load kotlin.coroutines.Continuation from parent classloader
^KT-66004 Fixed
2024-02-22 09:03:21 +00:00
vladislav.grechko f32367d2c2 Fix IrFunction.isEmptyArray implementation
The previous one was incorrect for K1 since parent of top-level function
is `IrClass`, not `IrPackageFragment`.

The change is non-functional, K1 still worked correctly, but had to do
some extra work when inlining `emptyArray` calls and produces less
performant bytecode.
2024-02-22 07:32:36 +00:00