Commit Graph

1685 Commits

Author SHA1 Message Date
Sebastian Sellmair 2708c74d9c [ObjCExport] Fix KT-64952 HasErrorTypesTest 2024-01-23 10:03:15 +00:00
Dmitrii Krasnov 7165d15d59 [Gradle Native] Added Kotlin Native Provider to all native tasks
This provider is a first step of "Kotlin Native Toolchain".
This solves several problems:
1) Resolving K/N bundle during configuration phase ->
now it happens during execution phase
2) Downloading K/N bundle with internal mechanisms ->
now it uses Gradle dependency resolvers and Transform Artifact

^KT-58303
^KT-52567
^KT-49268
2024-01-22 20:26:24 +00:00
eugene.levenetc 480b8ec516 [ObjCExport] Add object translation and error handling
- Also add forward declaration tests
- Add hidden types support
- Issues: KT-64857, KT-64952, KT-65080
2024-01-22 14:59:56 +00:00
Vladimir Sukharev e958e57c42 [K/N][Tests] Migrate test forwardDeclarationsCast.kt
^KT-61259
2024-01-22 12:29:57 +00:00
Vladimir Sukharev 2f3705f0eb [K/N][Tests] Move funptr.kt to standalone tests due to OUTPUT_DATA_FILE directive
^KT-61259
2024-01-22 12:29:57 +00:00
Vladimir Sukharev c286b0efd7 [K/N][Tests] Migrate tests forwardDeclarationsTwoLibs.kt
^KT-61259
2024-01-22 12:29:57 +00:00
Vladimir Sukharev bd688b3ef7 [K/N][Tests] Migrate tests kt49034*.kt
^KT-61259
2024-01-22 12:29:57 +00:00
Alexander Shabalin f15ca6a20f [K/N] More debugging output in HostExecutor ^KT-65113 2024-01-22 11:41:24 +00:00
Vladimir Sukharev 39e2187d31 [K/N][Tests] Split filecheck part from test direct.kt
^KT-61259
2024-01-19 18:31:25 +01:00
Vladimir Sukharev 833e125450 [K/N][Tests] Polish test sharing_with_weak.kt
^KT-61259
2024-01-19 18:22:22 +01:00
Vladimir Sukharev 4aa8774c6e [K/N][Tests] Migrate test direct.kt
^KT-61259
2024-01-19 18:22:22 +01:00
Vladimir Sukharev e59a80bd69 [K/N][Tests] Migrate test overridabilityCondition.kt
^KT-61259
2024-01-19 18:22:21 +01:00
Vladimir Sukharev 2d0009ff99 [K/N][Tests] Migrate test illegal_sharing_with_weak.kt
^KT-61259
2024-01-19 18:22:21 +01:00
Vladimir Sukharev 647a907204 [K/N][Tests] Migrate kt48816 tests
^KT-61259
2024-01-19 18:22:21 +01:00
Vladimir Sukharev 447c0fb618 [K/N][Tests] Migrate kt56048 test
^KT-61259
2024-01-19 18:22:21 +01:00
Vladimir Sukharev cc13888dd0 [K/N][Tests] Migrate second ObjC test with framework
^KT-61259
2024-01-19 18:22:21 +01:00
Vladimir Sukharev 1b18f4ed1e [K/N][Tests] Migrate first ObjC test with framework
^KT-61259
2024-01-19 18:22:20 +01:00
Vladimir Sukharev 6e2df0e086 [K/N][Tests] Migrate first Apple-specific test
^KT-61259
2024-01-19 18:22:20 +01:00
Alexander Shabalin 2da6946ac2 [K/N] Debug output for HostExecutor on windows ^KT-65113 2024-01-19 14:35:57 +00:00
Sergej Jaskiewicz bc5810ee67 [FIR2IR] Don't use descriptor manglers in FIR2IR
They don't do anything, only complicate the initial configuration.

KT-64990
2024-01-19 13:36:00 +00:00
Alexander Udalov b2c30921e4 JVM: support JVM-specific primitive/wrapper type overridability check
#KT-62045 Fixed
2024-01-19 12:30:48 +00:00
Ilya Kirillov 3a90cb00c7 [LL FIR] reuse the same function for registering K/N FIR session components as in the compiler
So, if a new component is registered in the compiler, it's not forgotten for the LL FIR

This registers `FirDelegatedMembersFilter` for K/N modules and fixes KT-64528

^KT-64528 fixed
2024-01-18 15:43:52 +00:00
Pavel Punegov 6b409d87f5 [K/N][test] Support library for running Kotlin/Native tests with XCTest
This change adds a library with cinterop that has XCTest wrapper around
Kotlin/Native tests (that are @kotlin.test.Test marked methods).
This library can be compiled with either test code using the option
`-produce test_bundle` to make a loadable test bundle or used inside
the existing ObjC/Swift tests if compiled to a framework.

The basic idea is to make XCTest be able to resolve separate test cases
and correctly show them in test reports. This was achieved by wrapping
test cases with dynamically created invocation methods. Test listeners
are integrated with XCTest Observation to make it possible to have 
the same ability to report with GTest or TeamCity logging.

Gradle build files use MPP Gradle plugin and use a bootstrap version
of K/N. Property `kotlin.native.home` was moved to the kotlin-native
subproject to not override this project's K/N distribution, that is
being used by the KGP with the same property.

This is a part of ^KT-58928


Merge-request: KT-MR-13268
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2024-01-18 15:04:37 +00:00
Ivan Kylchik 86e6912447 [FIR2IR] Don't generate excess IR block from FirSingleExpressionBlock
This is needed to unify K1 and K2 behavior.

#KT-65064
#KT-63781 Fixed
2024-01-18 10:59:01 +00:00
Artem Olkov 37a8723a79 KT-64931: add convertion of kotlin top-lvl functions into swift static functions
Merge-request: KT-MR-13878
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-01-17 20:30:04 +00:00
Vladimir Sukharev 48df87f635 [K/N][Tests] Migrate two more cinterop tests
^KT-61259
2024-01-17 08:33:41 +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
Vladimir Sukharev be9805ea5e [K2/N][Tests] Add test to demonstrate compiler behavior for ObjC properties intersection overrides
^KT-57640
2024-01-16 13:40:51 +00:00
Vladimir Sukharev 5f51f5e1fc [K/N] Migrate more cinterop tests
^KT-61259
2024-01-16 11:58:31 +00:00
Dmitriy Novozhilov f9ea353b60 [Native] Don't group K2 MPP tests in Native codegen tests
K2 in MPP compilation expects that it receives module structure
  with exactly one platform leaf module. This invariant may be broken
  during grouping tests, so MPP tests should be run in standalone mode
2024-01-16 09:01:32 +00:00
Pavel Kunyavskiy 882dc18e0e [IrActualizer] Don't copy attributeOwnerId in actualizer
In before, actualizer was copying attributeOwnerId to new
nodes. This leads to attributeOwnerId linked to non-actualized
node. It's unclear what it leads to, so we just stop doing that.

In particular, if attributeOwnerId references another node,
this information would be lost.

^KT-64895
2024-01-15 14:10:35 +00:00
Sergey Bogolepov d3864c841a [Native][tests] Adapt to OutputDataFile constructor changes 2024-01-15 11:18:28 +00:00
Sergey Bogolepov b8c1da7d1f [Native][Tests] Disable static library tests of MinGW 2024-01-15 11:18:28 +00:00
Sergey Bogolepov 85490f9201 [Native][Tests]Update executable location in AbstractNativeCExportTest
Changed the code in AbstractNativeCExportTest to create the executable
in the same directory as the dynamic library.
This update is to accommodate the lack of rpath on Windows systems.
2024-01-15 11:18:28 +00:00
Sergey Bogolepov 8611851b2c [Native][Tests] Fix clang invocation on Linux and Windows
* Pass proper args from ClangArgs
* Call exe binary on Windows
2024-01-15 11:18:28 +00:00
Sergey Bogolepov 30c91e47a9 [Native][Tests] Always use -Xllvm-variant=dev
FileCheck tests force using dev LLVM distribution. It breaks
invocation of LLVM Clang which tries to look for executable in a wrong
directory. Let's keep things simple and always pass dev variant to our
tests.
2024-01-15 11:18:28 +00:00
Sergey Bogolepov 96e5b2be79 [Native][tests] Improve clang invocation
* Wrap it into a proper TestCompilationResult
* Pass additional flags in case of dynamic library test
2024-01-15 11:18:28 +00:00
Sergey Bogolepov 2ed84f6a11 [Native][Tests] Make it possible to run LLVM Clang
Not all K/N targets have Clang in their toolchain. Thus,
we need to run the one from LLVM in our tests.
2024-01-15 11:18:28 +00:00
Sergey Bogolepov c165171471 [Native][tests] Port KT-36639 test case to the new infra 2024-01-15 11:18:28 +00:00
Sergey Bogolepov 1c24f994db [Native][tests] Initial support for CExport in the new test infra
Very trivial implementation of CExport test infrastructure based on
work from LLDB tests and ObjCExport tests.
2024-01-15 11:18:28 +00:00
Sergey Bogolepov 13618fc03b [Native][tests] Extract Clang invocation to a separate function 2024-01-15 11:18:28 +00:00
Timofey Solonin 0aa7b6f6ad Fix UnsafeNumber being applied incorrectly in hierarchical commonization
^KT-64376
2024-01-15 09:35:43 +00:00
Timofey Solonin 3c03e388d2 Record erroneous UnsafeNumber commonization behavior
^KT-64376
2024-01-15 09:35:43 +00:00
eugene.levenetc fc56f2af1c [ObjCExport] Fix top level property
KT-64923


Merge-request: KT-MR-13873
Merged-by: Eugene Levenetc <Eugene.Levenetc@jetbrains.com>
2024-01-15 01:49:37 +00:00
Sebastian Sellmair a713d66b7b [ObjCExport] Analysis Api: Ensure KDocs being exported by providing ObjCExportStubOrigin
^KT-64888 Fixed


Co-authored-by: Sebastian Sellmair <Sebastian.sellmair@jetbrains.com>


Merge-request: KT-MR-13854
Merged-by: Eugene Levenetc <Eugene.Levenetc@jetbrains.com>
2024-01-14 01:13:58 +00:00
Sergej Jaskiewicz eda30ff704 [klib] Implement diagnostics for clashing KLIB signatures
Now, we detect clashing signatures during serialization to KLIB and
report a compiler error if two or more declarations have the same
`IdSignature`

For example, for the following code:
```kotlin
@Deprecated("", level = DeprecationLevel.HIDDEN)
fun foo(): String = ""

fun foo(): Int = 0
```

the compiler will produce this diagnostic:
```
e: main.kt:1:1 Platform declaration clash: The following declarations
       have the same KLIB signature (/foo|foo(){}[0]):
    fun foo(): String defined in root package
    fun foo(): Int defined in root package
e: main.kt:4:1 Platform declaration clash: The following declarations
       have the same KLIB signature (/foo|foo(){}[0]):
    fun foo(): String defined in root package
    fun foo(): Int defined in root package
```

Note that we report this diagnostic during serialization and not earlier
(e.g., in fir2ir) for more robustness, so ensure that we check
exactly the signatures that will be written to a KLIB.
If we later introduce some annotation for customizing a declaration's
signature (e.g., for preserving binary compatibility), this
diagnostic will continue to work as expected.

^KT-63670 Fixed
2024-01-12 15:59:28 +00:00
Sebastian Sellmair 9c3de4332f [ObjCExport] Run new ObjCExport tests as native tests on CI
^KT-64839 Fixed
2024-01-12 15:37:41 +00:00
Dmitriy Novozhilov 8300ad76d0 [FIR2IR] Remember overridden symbols if f/o contains error types
^KT-64837 Fixed
2024-01-12 15:32:25 +00:00
Sergey Bogolepov 591e98a947 [KT-63275] Generate wrapper bodies in the SwiftExportExtension 2024-01-12 15:06:18 +00:00
Sergey Bogolepov cb19e291a3 [KT-63275] Implement trivial bodies in SIR functions 2024-01-12 15:06:18 +00:00