Commit Graph

710 Commits

Author SHA1 Message Date
Johan Bay 0a612e4268 [klib] Add an option to write out header klibs
The header klib is supposed to only contain the public abi of the module
similar to jvm-abi-gen. It is intended to be used as a dependency for other
klib compilations instead of the full klib for compilation avoidance.

^KT-60807
2023-08-29 13:25:07 +00:00
Stanislav Ruban 44a4c4ee1c [tests] BI (1P&1TV/1TIO): add tests for target types
single builder parameter
single postponed type variable
single origin of type information

relevant issues:
KT-60719
KT-60720
KT-60855
KT-60877
KT-60880
2023-08-25 14:01:56 +00:00
Ilya Chernikov b821009617 K2: add missing checks for integral parameter type on implicit coercion
#KT-61418 fixed
#KT-61442 fixed
#KT-61441 fixed
2023-08-25 08:55:58 +00:00
Svyatoslav Scherbina 0a2348e595 Native: add debugger test for inspecting string variables
We just had no tests checking that debugger can properly show values
of string-typed variables. This commit adds such a test.
2023-08-24 15:03:27 +00:00
Pavel Kunyavskiy eefc51657a [K/N] Fix debug info for lambdas inside inline functions
^KT-57365
2023-08-23 08:18:56 +00:00
mvicsokolova 76a1091820 [K/N]: Do not require JDK11 for :native:native.tests
This commit provides a small fix in the code of a native test runner so that JDK11 is not required and removes the JDK11 target for the atomicfu-compiler-plugin.

Fixes KT-61293

Merge-request: KT-MR-11757
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-08-22 13:32:38 +00:00
Roman Efremov 8aa3ccd342 [FIR] Store matched actual class members inside FIR attribute
Currently, there is only attribute `ExpectForActualAttributeKey`
where mapping is stored only for source declarations with `actual`
modifier. But we need mapping of all class members, including classes
which were actualized via `actual typealias` or fake override members.
This data will be needed for the annotation checker in subsequent
commits.

^KT-60668
^KT-60936
2023-08-22 12:14:42 +00:00
Kirill Rakhman fa77e3952d [FIR] Bring equivalent call behavior closer to K1
#KT-61159 Fixed
2023-08-21 12:11:58 +00:00
Igor Chevdar 7c67e9e08b [tests][lldb] Added a reproducer for #KT-61131 2023-08-21 12:05:28 +00:00
Igor Chevdar c1874d0184 [K/N][codegen] Added debug info to virtual functions trampolines
#KT-61131 Fixed
2023-08-21 12:05:28 +00:00
Nikolay Lunyak 73b4a81663 [FIR] Forbid complex boolean expressions
Disabling the language feature is supported,
otherwise there are too many tests that
would need to be updated to account for
K2's inability to do it.

The `ifConstVal.kt` test is deleted,
because now it must also be ignored in K2,
and since it is ignored for both the
frontends, and the ignored backends
include all the target backends, this test
is basically unused.

Note that now both the frontends report
`CONST_VAL_WITH_NON_CONST_INITIALIZER`.
for `condition`.

^KT-55196 Fixed
2023-08-18 15:16:13 +00:00
Kirill Rakhman 79fe48ab5b [FIR2IR] Support error qualifier in case of error suppression
#KT-60536 Fixed
2023-08-18 14:28:56 +00:00
Ivan Kochurkin 553114e245 [K2, MPP] Actualize annotation calls
^KT-57963 Fixed
2023-08-17 14:04:59 +00:00
Dmitriy Dolovov d691ab61d7 [KLIB] Keep "API for KLIB ABI" test data under "compiler/testData/klib/" dir
The test data is used both in ":kotlin-util-klib-abi" and
":native:native.tests" modules. It's better to keep it together with
the test data for other KLIB tests which are also used in more than one
module, i.e. in "compiler/testData/klib/" dir.
2023-08-16 19:11:35 +00:00
Dmitriy Dolovov cb92990ed6 [KLIB][tests] Reorganize "klib dump-metadata" tests
- Keep the test data under "native/native.tests/testData/klib/" dir
- Rename tests from "klib contents" to "klib dump-metadata"
2023-08-16 19:11:35 +00:00
Dmitriy Dolovov ec9370c30b [KLIB][tests] Reorganize "klib dump-ir" tests
- Keep the test data under "native/native.tests/testData/klib/" dir
- Rename tests from "klib ir" to "klib dump-ir"
2023-08-16 19:11:35 +00:00
Dmitriy Dolovov 60b950b9bd [KLIB][tests] Keep "klib evolution" test data under "testData/klib/" dir 2023-08-16 19:11:34 +00:00
Dmitriy Dolovov 5c3e63e19a [PL][tests] Keep PL test data under "testData/klib/" dir 2023-08-16 19:11:34 +00:00
mvicsokolova 9ff0e0b046 [atomicfu-K/N] Tests for K/N atomicfu-compiler-plugin
* `nativeTest` task now allows to provide compiler plugins that may be enabled during test compilation
* test sets for JVM and K/N backends are equal

KT-60800 describes all the issues with native tests that were solved in this commit.

Co-authored-by: Dmitriy Dolovov <Dmitriy.Dolovov@jetbrains.com>

Merge-request: KT-MR-11401
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-08-16 09:41:29 +00:00
Vladimir Sukharev 8f03eb9314 [K/N] Fix stdlib import in DiagnosticsNativeTests
Merge-request: KT-MR-11635
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-08-16 08:27:16 +00:00
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 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
Pavel Kunyavskiy 9cbd55aa72 [K/N] Intrinsify enumEntries<T>
^KT-59711
2023-07-25 14:24:44 +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
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
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