Commit Graph

1336 Commits

Author SHA1 Message Date
Alexander Korepanov 7a31167e0b [Common IR] Do not add internal methods to overrides
[JS IR] Use a module name in JsFunctionSignature for internal methods

^KT-60635 Fixed
2023-08-09 16:35:59 +00:00
Dmitriy Dolovov da2e6d93ff [Native][tests] Don't use trove4j in K/N new test infra 2023-08-09 12:15:39 +00:00
Dmitriy Novozhilov 4e3dbcada3 [FIR2IR] Always look for already generated fake overrides before creating them
This change covers the case where some f/o was generated in common module
  and it is referenced in platform code. But signature of this f/o may be
  different in different modules because of e.g. actualization of value
  parameters with actual typealias

^KT-60850 Fixed
2023-08-09 09:40:23 +00:00
marat.akhin ae4fab8483 [KMP] Allow matching expect ctorless final classes to objects
both directly and via typealias.

This is a possible fix to KT-59747
2023-08-08 23:18:35 +00:00
Igor Chevdar 9a719066e3 [K/N][tests] Added a reproducer for #KT-60371 2023-08-08 10:10:47 +00:00
Igor Chevdar 2f463f740f [K/N][tests] Fixed CachesAutoBuildTest & IncrementalCompilationTest
In auto-cache mode, the compiler itself chooses the system cache directory,
and it is important to not pass it explicitly.
2023-08-08 10:10:47 +00:00
Dmitriy Dolovov 3b626ea97c [Commonizer] Replace ResettableClockMark by TimeSource.Monotonic 2023-08-08 09:40:18 +00:00
Sebastian Sellmair d510c93241 [Commonizer] Support generic/simple annotation commonization (to support kotlinx.cinterop.* annotations)
^KT-59302 Verification Pending
2023-08-04 11:29:23 +00:00
Dmitriy Novozhilov cc2bc5e8b1 [FIR2IR] Reuse IR fake overrides for FIR fake overrides for all MPP modules
^KT-58229 Fixed
2023-08-03 10:02:57 +00:00
Zalim Bashorov cac5342add Generate tests 2023-08-01 23:48:24 +02:00
Dmitriy Dolovov 748eb2f9ee [KLIB] ABI reader: Tests for classes inherited from classes produced by Native interop tool
^KT-54402
2023-07-31 20:22:21 +00:00
Dmitriy Dolovov ac3c000ab1 [KLIB] Native K1 & K2 tests for dumping KLIB ABI
^KT-54402
2023-07-31 20:22:20 +00:00
Dmitriy Dolovov ca00c38fca [Native][tests] Use common test tag "klib" for all KLIB-related tests 2023-07-31 20:22:20 +00:00
mvicsokolova bed16f92b1 [atomicfu-K/N]: Support Native backend in atomicfu compiler plugin
Atomicfu compiler plugin supported transformations for K/N:
* atomic properties are replaced with volatile properties and all the operations are delegated to native atomic intrinsics
* atomic arrays are replaced with kotlin.concurrent.Atomic*Arrays
* all other features available on JVM are covered as well (custom atomic extensions, delegated properties, debug tracing)

See (KT-58358, https://github.com/Kotlin/kotlinx-atomicfu/issues/261)

Merge-request: KT-MR-11253
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-31 14:48:28 +00:00
Johan Bay fafea27283 [klib tool] Add option to print ir
Dumping the IR from a klib is useful for debugging klib compilations.

^KT-58877
2023-07-31 09:45:19 +00:00
Ivan Kylchik fe9de6875a [FIR2IR] Use a fully expanded type when generating IrClassReference
#KT-60639 Fixed
2023-07-28 09:02:45 +00:00
Ivan Kylchik 88191e8b1a [IR] Add new test to check that nullable access to enum is not evaluated
Just a safety check. If an expression like `EnumClass.Value?.name` was
evaluated, we would consider it as breaking change.
2023-07-27 22:50:21 +00:00
Stanislav Ruban 8bd823de0d [tests] BI (1P&1TV/1TIO): add tests for contexts of source-sink feeds
single builder parameter
single postponed type variable
single origin of type information

relevant issues:
KT-60274
KT-60663
2023-07-27 14:25:08 +00:00
Stanislav Ruban b13a225949 [tests] BI (1P&1TV/1TIO): add tests for basic cases
single builder parameter
single postponed type variable
single origin of type information

relevant issues:
KT-59551
2023-07-27 14:25:07 +00:00
Aleksei.Cherepanov f6963d04e9 Run K1 configuration on TC with languageVersion="1.9"
KotlinVersion is overrided on TC, so we need to rely on LanguageVersion

#KT-60589 Fixed
2023-07-27 14:15:49 +00:00
Leonid Startsev 648c1f4599 Support instantiation of annotations with type parameters
By ignoring type parameters. Since type parameters in annotations are a
very limited feature, their sole use is to be able to specify them as
KClass argument: annotation class Foo<T: Any>(val bar: KClass<T>).
Since we can encounter type param only as a KClass type argument (and
never as a property type), simple approach of ignoring them works fine.
In that case, since we simply copy property types to synthetic
implementation class, its properties in IR start look like this:
annotation class FooImpl(override val bar: KClass<T of Foo>). This IR
seems to be not completely correct, since FooImpl.bar type contains T of
Foo param, which is out of its scope. However, so far I didn't
encounter any problems with this during testing and after MR discussion
this approach has been considered possible.

#KT-59558 Fixed
#KT-59036 Fixed
2023-07-26 17:16:13 +00:00
Mikhail Glukhikh f20e2dec31 K2: generate Unit conversion for indexed assignment at raw FIR stage
#KT-59748 Fixed
2023-07-26 06:09:15 +00:00
Sergey Bogolepov 9daa40d2ed [K/N] Use platform_version instead of sdk_version and os_version_min 2023-07-25 14:30:06 +00:00
Pavel Kunyavskiy 9cbd55aa72 [K/N] Intrinsify enumEntries<T>
^KT-59711
2023-07-25 14:24:44 +00:00
Svyatoslav Scherbina 61dbe7fb75 [Gradle] temporarily change error to warning for linuxArm32Hfp
^KT-58864
2023-07-25 12:33:46 +00:00
Alexander Udalov 874d1c514a JVM: support enumEntries intrinsic for Kotlin enums
Implementation is very similar to the `enumValues` intrinsic.

Java enums and old (pre-1.9) Kotlin enums will be supported in a
subsequent commit.

 #KT-59710
2023-07-25 09:55:43 +00:00
vladislav.grechko e5763a692f Substitute type arguments to return type of inlined function references
Such substitution is crucial on codegen stage if the return type is
reified (e.g. for `Array`)

^KT-59507: Fixed
^KT-59281: Fixed
2023-07-24 22:11:59 +00:00
Pavel Kunyavskiy 488d24296a [K/N]: Allow invocation of volatile intrinsics on inline function constant arguments.
Invocation of atomic intrinsics is only allowed on property references that are known at compile time. This commit makes it possible to also invoke intrinsics on a constant property reference getter passed as an argument.
See KT-58359

Co-authored-by: Pavel Kunyavskiy <Pavel.Kunyavskiy@jetbrains.com>

Merge-request: KT-MR-10413
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-24 17:45:16 +00:00
Nikita Bobko 4f3ecedbca [FE] Stop ignoring ABSTRACT_MEMBER_NOT_IMPLEMENTED for expect classes
^KT-59739 Fixed
Review: https://jetbrains.team/p/kt/reviews/11038/timeline
2023-07-24 09:15:11 +00:00
Pavel Kunyavskiy fd564d4af9 [K/N] Disable custom import for forward declarations
If forward declaration exists in a library, it was
possible to import it both by forward declaration name
and normal library name. This is strange unique behavior.
And it would also make KT-59643 changes binary incompatible.
So from now it's only possible to import forward declaration by
forward declaration name only.

^KT-59642
2023-07-24 08:24:20 +00:00
Zalim Bashorov b1a4d354f1 Regenerate tests 2023-07-21 17:27:17 +00:00
Svyatoslav Scherbina bcc4a891be Native: add tests for ExperimentalForeignApi on cinterop declarations
Add tests checking that all (top-level) declarations generated by
cinterop now have ExperimentalForeignApi annotation.

^KT-58362
2023-07-21 11:54:14 +00:00
Svyatoslav Scherbina 3280d3ef80 Native: prepare existing tests for cinterop adding ExperimentalForeignApi
cinterop tool should add ExperimentalForeignApi to all generated
declarations by default. This commit prepares existing tests for this.

^KT-58362
2023-07-21 11:54:14 +00:00
Sergey Bogolepov becbca2284 [K/N] Fix DeclarationDescriptor.findObjCExportMetaAnnotations
`require` is failing in the presence of error types,
so use nullability instead.
2023-07-21 09:57:22 +00:00
Ivan Kylchik 30c00f7983 [IR] Specify explicitly that classes from Java can be interpreted
In early prototypes of interpreter, it was easier to assume that
all classes from Java can be interpreted and fix something if not.
Check for Java declaration was done by checking that the package name is
starting with "java". But this is actually wrong and can lead to errors
when some code is declared in "java" something package, but is not from
Java stdlib.

#KT-60467 Fixed
2023-07-20 09:40:42 +00:00
Ivan Kylchik 2ecbb21a9f [IR] Add new tests on inline to check issues with type parameters
#KT-58241
2023-07-20 09:01:42 +00:00
Mikhail Glukhikh 08222c83cf K1/K2: set language version explicitly in Native tests pipeline 2023-07-19 06:46:53 +00:00
Alexander Udalov 69059362b8 Fir2Ir: generate 'finally' block always with Unit type
This is important for IR lowerings like PolymorphicSignatureLowering
which are very sensitive about the correct types of expressions and
placement of coercions to Unit (KT-59218).

A boolean parameter to `insertImplicitCasts` is not the best solution to
ensure that coercion to Unit is added. The best solution would be to fix
the TODO and generate coercion to the block's type for the last
statement. But that will affect many other places and will need to be
done separately => KT-59781.

Code in IrInterpreter is uncommented to fix the FIR test
`compiler/testData/ir/interpreter/exceptions/tryFinally.kt`; otherwise
evaluation of the function `returnTryFinally` there crashes with
"NoSuchElementException: ArrayDeque is empty". No idea why this test
didn't fail for K1 though, since the created IR is exactly the same.

For some unknown reason this breaks WASM backend with K2, but not with
K1 => KT-59800.
2023-07-18 11:37:41 +00:00
Alexander Udalov 5513740659 Minor, remove extraneous box tests
These tests are already present in
`compiler/testData/codegen/box/classes/kt496.kt`.
2023-07-18 11:37:41 +00:00
Dmitriy Dolovov ce815968cf [Native][tests] Use convention fun generatedTestDir() in build.gradle.kts 2023-07-17 21:09:40 +00:00
Dmitriy Dolovov 938146749d [PL][tests] K/JS: Avoid any unexpected warnings to appear in tests 2023-07-17 21:09:40 +00:00
Dmitriy Dolovov 19c6208cc0 [PL][tests] K/N: Avoid any unexpected warnings to appear in tests 2023-07-17 21:09:40 +00:00
Alexander Shabalin bdb534c3de [K/N] Fix perf build 2023-07-17 16:56:34 +00:00
Kirill Rakhman feed740415 [FIR2IR] Don't copy default value to annotation call with vararg parameter
This aligns the behavior with K1 and fixes an issue when the default
value was deserialized as FirExpressionStub leading to an exception
in FIR2IR when trying to convert it to an IR expression.

#KT-60120 Fixed
#KT-59610 Fixed
2023-07-17 11:42:39 +00:00
Pavel Kunyavskiy 6da3ecceab [K/N] Implement frontend checkers for usages forward declaration type
Forward declaration type doesn't exist in runtime. This restricts
its possible usages.

^KT-59764
2023-07-17 09:24:33 +00:00
mvicsokolova d9fa9c1b3b [K/N] Introduce intrinsics that atomically update array elements
Supported atomic update of elements for IntArray, LongArray and Array<T>
See KT-58360

Merge-request: KT-MR-11020
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-12 14:32:36 +00:00
Dmitrii Krasnov f2816a5531 Added property for overriding konan distribution location
#KT-50463 Fixed

Merge-request: KT-MR-10310
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2023-07-12 12:36:51 +00:00
Brian Norman 10ed26991d [FIR] Extract LHS receiver of assignment operator statements
#KT-53490 Fixed
2023-07-12 11:41:33 +00:00
Ivan Kylchik ad6332112e [IR] Support const optimizations for Native backend 2023-07-10 13:19:51 +00:00
Pavel Kunyavskiy ef9413108b [K/N] Consolidate forward declarations handling
This is refactoring in preparation for KT-59764.
Names and layout of forward declarations related classes
was copy-pasted many times over compiler code.

Implementing KT-59764 would require copy-pasting it two more times.
So instead of doing this it was put in single place.

No behaviour changes intended in this commit.
2023-07-10 08:59:16 +00:00