Commit Graph

103075 Commits

Author SHA1 Message Date
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
Kirill Rakhman 95005dae8a [FIR PSI] Set source of equality operator call
#KT-55835
2023-07-20 07:29:19 +00:00
Kirill Rakhman 9e9b92fd16 [FIR PSI] Set source of error reference
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman 070b694247 [FIR] Get rid of implicit type refs with source
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman 91dad7b952 [FIR] Set source of smart-cast expressions automatically
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman 9288a96f6d [FIR] Assert source is not-null when reporting cone diagnostics
#KT-55835
#KT-59856
2023-07-20 07:29:18 +00:00
Kirill Rakhman 2f3293f99e [FIR] Skip redundant INAPPLICABLE_CANDIDATE on call with unresolved callable reference argument
A new resolution diagnostic UnsuccessfulCallableReferenceAtom is
introduced that is used in EagerResolveOfCallableReferences.
No diagnostic is reported on unresolved calls with this diagnostic
because

#KT-59856
2023-07-20 07:29:18 +00:00
Kirill Rakhman a55f3c5583 [FIR LT] Set source on FirExplicitSuperReference
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman ccab42cd2a [FIR LT] Set source on FirExplicitThisReference
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman bed6cb7154 [FIR] Make FirFile.annotationsContainer nullable
Previously, when no file annotations were present, the FIR element
didn't have a source.
By making it nullable, it will only be created when appropriate and the
source will never be null.

#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman 311975f1ed [FIR] Set source on return expression in generated getters
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman ef086a4c88 [FIR] Eliminate null field in FirNoReceiverExpression
#KT-55835
2023-07-20 07:29:18 +00:00
Roman Golyshev b8052761db KT-60341 [Analysis API] Provide a type for a FirNameReference only when it refers to an actual property/variable
We cannot always return null, because in such case some expressions
would become not fully explorable from the types perspective (see
the documentation on the `getCorrespondingTypeIfPossible`)

`FirNamedReference` might appear when resolving method references (like
`foo::bar`), but also when IJ Platform tries to resolve other parts of
the Kotlin PSI, notably a `KtNameReferenceExpression` in a
function call (`bar` in `foo.bar(baz)` expression).

N.B. FE10 implementation does not support returning `null` as a type -
currently it always returns `Unit` type in case it cannot figure out
the actual type. This issue should probably be tackled together with
KT-60166, so that both implementations are more or less aligned

^KT-60341 Fixed
^KT-59077 Fixed
^KTIJ-25745 Fixed
2023-07-19 22:01:37 +00:00
Yahor Berdnikau 19a60d6b85 [Gradle] Fix kapt test with different JDK versions
This test was incorrect as it configured JVM toolchain to use JDK 1.8.
This configured JVM toolchain forced kapt tasks to always use JDK 1.8
even if the build itself was running on different JDK versions. Now test
uses different values for JVM toolchain which should correctly
configure kapt JDK.

^KT-59588
2023-07-19 18:58:53 +00:00
Yahor Berdnikau 63b0e900a9 [repo] Start using version catalog in the main build 2023-07-19 17:53:10 +00:00
Yahor Berdnikau 9294a74bf2 [repo] Fix 'prepare-deps' sub-project was not included in build 2023-07-19 17:53:10 +00:00
Yahor Berdnikau 45d8a8e56a [repo] Simplify buildsrc-compat/build.gradle.kts configuration
Use the Kotlin extension to configure toolchain and compiler options.
2023-07-19 17:53:10 +00:00
Yahor Berdnikau d743dc70ac [repo] Add version catalog for gradle-build-conventions included build 2023-07-19 17:53:10 +00:00
Yahor Berdnikau 67ea8b09e7 [repo] Migrate settings.gradle into settings.gradle.kts 2023-07-19 17:53:10 +00:00
Yahor Berdnikau 92baeefeaf [repo] Add version catalog for gradle-settings-convensions included build 2023-07-19 17:53:10 +00:00