Commit Graph

1053 Commits

Author SHA1 Message Date
Alexander Udalov d450e3074b IR: do not build fake overrides for static members of interfaces
Split members into static/non-static, and only build fake overrides for
inherited static members of classes.

 #KT-65276 Fixed
 #KT-65277 Fixed
2024-02-01 23:25:50 +00:00
Brian Norman dde2156f5f [FIR2IR] Always use property type if var
For destructing calls, the component type is used for the property type
in all cases. However, this can result in runtime and/or compilation
errors when the property is a var and changed, especially when the
component is a primitive but the property type is nullable. Instead,
only use the component type when the property is also a val.

^KT-64944 Fixed
2024-01-31 22:27:18 +00:00
Vladimir Sukharev 118a5cee06 [K/N][Tests] Cleanup tests code from old infra
^KT-61259
2024-01-31 16:17:21 +00:00
Vladimir Sukharev 2276abfb85 [K/N][Tests] Use GTest patterns for ignored tests
^KT-61259
2024-01-31 16:17:21 +00:00
Vladimir Sukharev 1ca79e645a [K/N][Tests] Use runProcess for code signing
^KT-61259
2024-01-31 16:17:21 +00:00
Vladimir Sukharev 524f0d335e [K/N][Tests] Migrate objcSmoke & objcTests tests
^KT-61259
2024-01-31 16:17:21 +00:00
Kirill Rakhman 853ad54699 [FIR] Fix incorrect updating of callable reference type in delegated property
... if the delegate happens to be a function call whose second
argument is a callable reference but not actually a provideDelegate
call.
The fix is to ensure that the call is _actually_ a desugared
provideDelegate call.

This fixes a CCE in a case where the delegate expression is a regular
function call and the second argument is a callable reference.

#KT-65165 Fixed
2024-01-31 14:51:51 +00:00
Sergej Jaskiewicz 03aa14b473 [klib] Use "IR signatures" i/o "KLIB signatures" in diagnostics
We already use the term "IR signatures" in other places.
2024-01-30 20:47:09 +00:00
Sergej Jaskiewicz 6900e20096 [klib] Fix exception for clashing signatures from different modules
If we encounter a declaration in the current module whose signature
is the same as that of a declaration in another module which we happen
to also reference from the current module, don't report any errors,
just like we don't do it in Kotlin/JVM. This leaves the user in the KLIB
hell situation, but this is intentional, because otherwise a legitimate
change like moving a declaration to another module and marking
the original one as `@Deprecated("", level = DeprecationLevel.HIDDEN)`
would lead to a error, and we don't want that.

Also, don't try to show the diagnostics on a declaration that doesn't
have an IrFile.

^KT-65063 Fixed
2024-01-30 20:47:09 +00:00
vladislav.grechko 8b1d87848d [FIR2IR] Fix unwrapping of single-statement blocks
Unwrapping should be done with respect to `forceUnitType` parameter.

^KT-65019: Fixed
2024-01-30 14:26:10 +00:00
Sergej Jaskiewicz f39335b3f7 [klib] Don't pass around metadata serialization closure
Pass the metadata serializer instance instead. This allows to further
reduce code duplication by introducing the common interface
`KlibSingleFileMetadataSerializer` for abstracting away K1 and K2
representation of a source file, as well as reusing
`Fir2KlibMetadataSerializer` across different backends.

KT-64392
2024-01-29 21:07:43 +00:00
Alexander Shabalin ce291b45b9 [K/N][tests] Cache executors based on testTarget 2024-01-29 14:12:14 +00:00
Alexander Shabalin 65abb5de46 [K/N][tests] Remove now unused LocalTestRunner 2024-01-29 14:12:14 +00:00
Alexander Shabalin f2ba4a3e6e [K/N][tests] Use HostExecutor in new test infra 2024-01-29 14:12:14 +00:00
Artem Kobzar 1fe77705b0 [K/Wasm] Convert non-capturing lambdas into singletons ^KT-64803 Fixed 2024-01-29 12:52:18 +00:00
vladislav.grechko f318b5969d Erase non-reified type parameters by-default when inlining.
Substitution of type arguments to non-reified type parameters may lead
to accidental reification, which should not be done (see ^KT-60174 for
examples). So, we should erase them, except the few cases.

^KT-60174: Fixed
^KT-60175: Fixed
2024-01-26 18:31:20 +00:00
Denis.Zharkov ca80ddb8ca K2: Run completion-writer related PCLA tasks for irregular call kinds
- For synthetic calls
- For delegated constructor calls

Also, I checked that for each toResolvedReference() (beside annotations)
that converts candidate to the resolved reference,
we run `runPCLARelatedTasksForCandidate()` in the same context.

^KT-65103 Fixed
2024-01-26 18:13:27 +00:00
Ivan Kylchik 69c83698fb [Native] Add K2 version of LLDB tests 2024-01-26 15:54:41 +00:00
Ivan Kylchik 2ded62c53e [Native] Drop LLDB_TRACE test directive
This directive doesn't have a lot of meaning. It is always set this
way that we are getting text file with the same name as test file.
2024-01-26 15:54:41 +00:00
Svyatoslav Scherbina 2e5a9b1416 [K/N] Make cinterop include unused Objective-C forward declarations
Previously, when an Objective-C library had an unused Objective-C
forward declaration (`@class` or `@protocol`), cinterop tool didn't
include it into the resulting klib at all.

This led to a subtle bug (KT-64105). One Obj-C library has unused
Obj-C forward declaration, and another one depends on the first and
uses this forward declaration, e.g. as a function result type.
When building the first cinterop klib, this forward declaration is not
added to `includedForwardDeclarations` in the klib manifest (the
compiler uses this property to decide whether to synthesize the
corresponding class).
When building the second cinterop klib, the forward declaration is not
added to its manifest either, because it is located in the dependency
(and therefore should've been included there).
As a result, the forward declaration is included nowhere, and any
attempt to use it in Kotlin fails, including calling the function from
the second lib.

This commit fixes this bug by including even unused Objective-C forward
declarations, which is consistent with any other kind of declarations
and seems more natural.

^KT-64105 Fixed
2024-01-25 14:06:10 +00:00
Svyatoslav Scherbina 59142b3051 [K/N][tests] Fix using objcnames package in grouped tests
Native test infra groups individual tests into compilations, so it
renames packages, patching package and import directives, to avoid
clashes.
This doesn't include "standard" packages. They are distinguished by a
predicate defined in the test infra. This predicate didn't include
`objcnames.*` -- synthetic package provided by the compiler.
As a result, tests importing from `objcnames.*` got those import
directives patched, which was unexpected and could make tests fail.

This commit fixes the problem, making `objnames.*` recognized as
a "standard" package.
2024-01-25 14:06:10 +00:00
Svyatoslav Scherbina ffb0b063a8 [K/N][tests] Support dependencies for cinterop modules
When building cinterop klibs, cinterop tool can accept dependencies,
which affects the way it processes the native library.
The test infrastructure allowed to specify cinterop module dependencies,
but didn't actually pass them to the tool.
This commit fixes that.
2024-01-25 14:06:10 +00:00
Alexander Zakharenko f502edd1de [K/N] Debug output for flaky test
Compiler output for testReleaseCompilerAgainstPreReleaseLibrary added

^KT-64822
2024-01-24 11:43:21 +00:00
Mikhail Glukhikh 51093a4764 K1/K2: add a group of BB test around primitives in Java
Related to KT-62554, KT-63242
2024-01-24 08:39:18 +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
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
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
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
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