Commit Graph

102894 Commits

Author SHA1 Message Date
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
Svyatoslav Scherbina 93ef98cbec Native: make .annotations mutable for some Stub IR nodes
cinterop tool should add ExperimentalForeignApi to all generated
declarations by default. To make this possible to implement in a
non-intrusive manner, this commit enables adding annotations to some of
the existing Stub IR nodes.
After that, one can add annotations to all generated declarations with
a simple post pass.

^KT-58362
2023-07-21 11:54:14 +00:00
Svyatoslav Scherbina d118844b17 Native: represent ExperimentalForeignApi in cinterop's Stub IR
cinterop tool should add ExperimentalForeignApi to all generated
declarations by default. This commit supports this annotation in
cinterop intermediate representation -- Stub IR.

^KT-58362
2023-07-21 11:54:14 +00:00
Svyatoslav Scherbina 7ca0cb1077 Native: don't add ExperimentalForeignApi to platform libs
Use -Xdisable-experimental-annotation when generating platform libs.
As a result, unlike all other cinterop libraries, declarations in
platform libs won't require ExperimentalForeignApi opt-in

^KT-58362
2023-07-21 11:54:14 +00:00
Svyatoslav Scherbina cabb25d3e0 Native: add -Xdisable-experimental-annotation flag to cinterop
It disables adding `ExperimentalForeignApi` opt-in to declarations
generated by cinterop.
Main use case is platform libraries, which are not supposed to have this
annotation. Applying the flag to user cinterop libraries is discouraged
and effectively means opting in.

^KT-58362
2023-07-21 11:54:14 +00:00
Svyatoslav Scherbina 1053d18871 Native: add support for annotations on typealiases in cinterop
^KT-58362
2023-07-21 11:54:14 +00:00
Anton Lakotka 67f4343137 [Gradle] rework addSourceSet to not let sourceSets be exposed in groovy
Also mark it as deprecated to prevent internal misuses.

^KT-58234 Verification Pending
2023-07-21 11:47:01 +00:00
Anton Lakotka f05856f6a0 [Gradle] Lower deprecation level of KotlinCompilation source method
It makes IDE Import failing when method is used.
So tooling diagnostic with ERROR level is preferred in such cases.

^KT-58234 Verification Pending
2023-07-21 11:47:01 +00:00
Anton Lakotka c3b09e148b [Gradle] Add KotlinCompilationSourceDeprecation diagnostic
^KT-58235 Verification Pending
2023-07-21 11:47:01 +00:00
Anton Lakotka 245825cf8b [Gradle] Elevate KotlinCompilation.source deprecation to ERROR
Fix internal use of this API with dedicated internal function.

^KT-58234 Verification Pending
2023-07-21 11:47:01 +00:00
Svyatoslav Scherbina aecf18b842 Native: move copying of toolchain builder artifact from Docker to host
Don't make Docker container copy artifact to a host directory mounted
with -v, because this fails due to a file permission issue:
build is run by a regular user, but the volume directory inside the
container is owned by root.

Instead, make the host copy the artifact from the container.

Also, make the container print the artifact path before that.
Just in case, in order to easily copy file manually, should something
go wrong.

^KT-58864
2023-07-21 10:40:13 +00:00
Svyatoslav Scherbina a276ad48a0 Native: don't use -it for docker run in toolchain builder
To make it more suitable for running in a CI

^KT-58864
2023-07-21 10:40:13 +00:00
Svyatoslav Scherbina 28a736ea30 Native: update isl download URL in a toolchain builder config
The previous URL no longer works. The isl project has moved hosting to
sourceforge.io. Update the mirror accordingly.
This is fixed in Crosstool-NG 1.25.0, but the URL is included in config
and needs to be updated there.

Note: to make the rest of toolchains buildable, the same change should
be applied to their configs.

See also https://github.com/crosstool-ng/crosstool-ng/pull/1614.

^KT-58864
2023-07-21 10:40:12 +00:00
Svyatoslav Scherbina 4e563aa299 Native: add arm toolchain gcc-8.3.0-glibc-2.12.1-kernel-4.9.config
Based on gcc-8.3.0-glibc-2.19-kernel-4.9.config, but with glibc version
downgraded from 2.19 to 2.12.1.

^KT-58864
2023-07-21 10:40:12 +00:00
Svyatoslav Scherbina 3c568e7b86 Native: update zlib download URL in toolchain builder
zlib 1.2.11 has been moved to fossils/ on the official website.

^KT-58864
2023-07-21 10:40:12 +00:00
Svyatoslav Scherbina 785e70c31a Native: update toolchain builder Docker image to Ubuntu 16.04
Ubuntu 14.04, used before, has expired root SSL certificate for
Let's Encrypt. As a result, OpenSSL couldn't verify SSL certificates
issued by Let's Encrypt, failing, in particular, kernel download.

^KT-58864
2023-07-21 10:40:12 +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
Pavel Kunyavskiy b6060f8440 [K/N] Fix lazy header export in one-shot compilation mode 2023-07-21 09:37:52 +00:00
Kirill Rakhman e35a28d36d [FIR2IR] Correctly map arguments of type alias constructor call
Previously, we applied type arguments as is when converting type alias
constructor calls to IR.
Now, we map them using the expansion of the type alias.

#KT-59743 Fixed
2023-07-21 07:45:52 +00:00
Sergej Jaskiewicz b4335c86c8 [IR] Add a new parameter to IrFactory#createPropertyWithLateBinding
This is to prepare for IrFactory auto-generation (KT-59308).
2023-07-20 19:58:47 +00:00
Dmitrii Gridin 8820867341 [FIR] support flexible types in ConeKotlinType#independentInstance
^KT-60580 Fixed
2023-07-20 17:22:56 +00:00
Dmitrii Gridin dc56c5cf9e [LL FIR] FileStructure: avoid synchronizations on cache access
From `ConcurrentMap#compute`
>The entire method invocation is performed atomically.
>Some attempted update operations on this map by other threads may
>be blocked while computation is in progress, so the computation
>should be short and simple

And we can call resolution (`reanalyze()`) under this synchronized
block that can take unpredictable time.

This fix drops all heavy operations from synchronization
2023-07-20 14:20:51 +00:00
mvicsokolova 5c5367d377 [atomicfu-JVM] Preparation for commonization of JVM and K/N transformers
The following updates in the JVM/IR plugin were made:
* Lots of refactoring with preparation for K/N support: commonization of transformations.
* Improved error handling (checks for visibility constraints, appending message about usage constraints in case of an error).
* Explicit requirements for the visibility of atomic properties: to prevent leaking they should be private/internal or be members of private/internal classes.
* Fixed visibility of generated properties: volatile properties are always private and atomic updaters have the same visibility as the original atomic property.
* Volatile fields are generated from scratch and original atomic properties are removed.
* Delegated properties support is fixed (only declaration in the same scope is allowed).
* Non-inline atomic extensions are forbidden.
* For top-level atomics: only one wrapper class per file (with corresponding visibility) is generated.
* Bug fixes.

The corresponding tickets: 
https://github.com/Kotlin/kotlinx-atomicfu/issues/322
KT-60528



Merge-request: KT-MR-10579
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-20 13:59:23 +00:00
Kirill Rakhman 6ca95dc338 [Tests] Fix test data after bed6cb7154 2023-07-20 13:37:38 +00:00
Nikolay Lunyak 84dd1acec1 [FIR] Check typealiases in supertypes
^KT-59830 Fixed

Merge-request: KT-MR-11187
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-07-20 12:50:06 +00:00
Zalim Bashorov 8a645e9c0a [Wasm] Don't print recursion group in wat when it's empty 2023-07-20 11:49:28 +00:00
Zalim Bashorov 590400071b [Wasm] Define canonical representation for NaNs explicitly instead of depending on Kotlin's one
Surprisingly with `Float.NaN.toRawBits()` you can observe different values,
which can lead to different wat files for the same input.
2023-07-20 11:49:28 +00:00
Zalim Bashorov 151f5b90c7 [Wasm] Wrap a recursion group by a "rec" block in wat 2023-07-20 11:49:28 +00:00
Zalim Bashorov 8a9531ce3c [Wasm] Don't print "field" for array types in wat 2023-07-20 11:49:28 +00:00
Zalim Bashorov 8d440a61e2 [Wasm] Make types for none and noextern consistent with the spec 2023-07-20 11:49:28 +00:00
Zalim Bashorov 2d13cbae80 [Wasm] make adding sections a bit more typesafe and extract possible values to WasmBinary 2023-07-20 11:49:28 +00:00
Zalim Bashorov a819a734b8 [Wasm] extract some "mages numbers" to simplify their update and improve readability
In preparation for KT-59720
2023-07-20 11:49:28 +00:00
Dmitrii Krasnov 04dce8a3f0 Added configuring <SingleNativeTarget> for subprojects nativeProject form testDsl
#KT-51553 In Progress
2023-07-20 11:05:05 +00:00
Ivan Kochurkin b98dbf7b56 [FIR] Use singleOrNull instead of firstOrNull for WHEN_MISSING_CASES renderer 2023-07-20 11:04:18 +00:00
Ivan Kochurkin 529d5a1df2 [FIR] Add description to NO_ELSE_IN_WHEN and fill it for expect enum or sealed declarations 2023-07-20 11:04:18 +00:00
Ivan Kochurkin 8c39b2f71d [FIR] Report missing NO_ELSE_IN_WHEN for when statement with expect enums and sealed classes
^KT-59404 Fixed
2023-07-20 11:04:17 +00:00
Mikhail Glukhikh 834bd1a71c K1/K2: split incremental JPS tests properly (relates to KT-59171) 2023-07-20 10:57:45 +00:00
Ivan Kochurkin d8ccf21894 [FIR] Fix false positive "suspension point is inside a critical section"
^KT-55072 Fixed
2023-07-20 10:38:59 +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 Kochurkin 43c66ee0e5 [FIR] Fix arguments mapping for indexed set operator
Now processPositionArgument changes STATE as well as processNamedArgument

^KT-59386
2023-07-20 09:38:28 +00:00
Ivan Kochurkin 8f5294a508 [FIR] Consider explicit returns during computing return type of anonymous function
Introduce FirAnonymousFunctionReturnExpressionInfo

^KT-59386
2023-07-20 09:36:55 +00:00
Sergej Jaskiewicz 212c10e674 [IR] Restore source compatibility for IrFactory methods
Previous commits:
c2fde1a915,
0b7db067e6,
0ae95b39c3,
f46761a241,
b1f7b5e982,
2b4a08524d,
5b8b3644fc,
7b77ec9930,
30cd2c3025,
9fcdc10019

have reordered parameters in IrFactory methods.

Restore and deprecate the original methods to
preserve source compatibility for compiler plugins.

KTIJ-26314
^KT-59772 Fixed
2023-07-20 09:36:05 +00:00
Ivan Kylchik 7fd601b336 [JVM_IR] Unify code between fake variables lowerings
#KT-58778 Fixed
2023-07-20 09:01:43 +00:00
Ivan Kylchik 1dec9fc675 [JVM_IR] Move methods that generate LN into LineNumberMapper class 2023-07-20 09:01:43 +00:00
Ivan Kylchik b10f6907a7 [JVM_IR] Slightly rewrite SwitchGenerator to improve readability 2023-07-20 09:01:42 +00:00
Ivan Kylchik ecd20b1348 [JVM_IR] Properly handle inlined local var located in regenerated object
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik 17e49fce75 [JVM_IR] Support basic fake var generation for IR inliner
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik 5a09ca6908 [JVM] Slightly rewrite inliner code to understand it more easily 2023-07-20 09:01:42 +00:00
Ivan Kylchik 286090a1db [IR] Drop inlinePureArguments parameter from FunctionInlining
Replaced its usages with `alwaysCreateTemporaryVariablesForArguments`
2023-07-20 09:01: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