Commit Graph

103376 Commits

Author SHA1 Message Date
Dmitrii Gridin 0e0847bc9d [LL FIR] support lazy bodies in scripts
Also, it adds guards to avoid problems with PCE

^KT-60728 Fixed
^KT-60519 Fixed
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 2f57916869 [FIR] add replaceStatements to FirScript
It is required to implement StateKeeper for scripts
statements should be MutableOrEmptyList to avoid CME

^KT-60728
^KT-60519
2023-08-02 16:50:45 +00:00
Dmitrii Gridin a2dc6ca8f2 [FIR] add RawFirBuilder test for script
^KT-60728
^KT-60519
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 2c932c9e1d [LL FIR] add proper lazy resolve support for script dependent declarations
Such declarations (only `ResultProperty` for now) should delegate
resolution to the script, because they depend on its content

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin f549712912 [FIR] FirCallableSymbol: introduce calculateReturnType
It will help to avoid copy-pasted logic there it is needed

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 35b0cd65e9 [FIR] PsiRawFirBuilder: add missing script configurator
PsiRawFirBuilder#visitScript didn't work because it didn't
have a configurator
Now FirScriptConfiguratorExtension split into two parts:
* File
* Script

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 32e3b67416 [LL FIR] LLFirTargetResolver: add default implementation to withFile and withRegularClassImpl
To drop redundant implementations in resolvers

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin de48a51711 [LL FIR] avoid redundant context collection
We assume that declaration context will be collected
during `LLFirAnnotationArgumentsTargetResolver`, so other
`LLFirAbstractBodyTargetResolver` shouldn't repeat this process

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 1a3b0fa9d5 [LL FIR] provide script scopes to declarations
All transformations inside a script should be
under the script context for proper resolution

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 544341412a [LL FIR] extract LLFirResolveTargetWithDedicatedElement
It is required to simplify the logic in the next commit.
Also, it drops redundant inheritance from [firFile] and [path] properties

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin dc347e2aa6 [LL FIR] add tests on specific cases in scripts resolve
* args
* $$result

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 63c6c38952 [LL FIR] LLFirPhaseUpdater: update phases inside delegate expression
^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 7a2dad5ca5 [LL FIR] create separate FileStructureElement for script
It is required to avoid duplication visiting on declarations

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 97e330997b [LL FIR] support scripts in BODY_RESOLVE transformer
^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 6cb1142210 [LL FIR] support scripts in annotation transformers
^KT-60728
2023-08-02 16:50:44 +00:00
Dmitrii Gridin efc6ca27b2 [LL FIR] support scripts in TYPES transformer
^KT-60728
2023-08-02 16:50:44 +00:00
Dmitrii Gridin 64bdcc1131 [LL FIR] support scripts in COMPILER_REQUIRED_ANNOTATIONS transformer
^KT-60728
2023-08-02 16:50:44 +00:00
Dmitrii Gridin 95e04c97cc [LL FIR] LLFirWholeFileResolveTarget should process script declarations
^KT-60728
2023-08-02 16:50:44 +00:00
Dmitrii Gridin 3686bf7ff9 [LL FIR] allow independent resolve for declarations in scripts
^KT-60728
2023-08-02 16:50:44 +00:00
Dmitrii Gridin 61981f6026 [LL FIR] skip FirScript resolve in transformers
It is a temporary step to be able to implement
granular scripts support

^KT-60728
2023-08-02 16:50:44 +00:00
Ivan Kochurkin f31786c2a0 [FIR] Resolve <implicit> to FirErrorTypeRef for unresolved synthetic arrayOf call 2023-08-02 16:23:36 +00:00
Ivan Kochurkin 4d7e54b2bb [FIR] Add a test to make sure that arrayOf function is always presented
Because it's located in builtins but not in stdlib.

It should work even if no runtime is specified.

^KTIJ-26465
2023-08-02 16:23:35 +00:00
Ivan Kochurkin 8a482c50c2 [FIR] Fix "List has more than one element" for arrayOf call (workaround)
It happens because several builtins are loaded, but it should be only
single builtin

^KT-60824 Fixed
^KTIJ-26465
2023-08-02 16:23:35 +00:00
Pavel Kunyavskiy f989037f7c [K/N] Mark forward declarations as OptIn if annotation exists
^KT-60841
2023-08-02 15:42:31 +00:00
Denis.Zharkov 180a3bb320 K1: Fix false-positive ABSTRACT_MEMBER_NOT_IMPLEMENTED with JDK 21
Previously, it was reported for List.toArray because, when traversing
supertypes, we've been stopped at j.u.SequencedCollection
as it has no JavaAnalogue.

^KT-60770 Fixed
2023-08-02 15:32:25 +00:00
Alexander Udalov e3efff7a33 K2: remove dependencies of fir-serialization on JVM modules 2023-08-02 14:50:10 +00:00
Alexander Udalov 2b84463ec8 K2: remove dependency fir-deserialization -> metadata.jvm 2023-08-02 14:50:10 +00:00
Alexander Udalov bdd94dddaa K2: remove dependency fir-deserialization -> deserialization.common.jvm
Move FirConstDeserializer to fir:java.
2023-08-02 14:50:10 +00:00
Alexander Udalov 3e313bca78 K2: remove dependency fir-deserialization -> compiler.common.jvm
- Rename DeserializedClassConfigurator -> FirDeserializationExtension to
  abstract the existing behavior (about the Serializable supertype), as
  well as any future JVM-specific deserialization behavior.
- Rename JvmDeserializedClassConfigurator ->
  FirJvmDeserializationExtension and move it to fir:java.
2023-08-02 14:50:10 +00:00
Roman Efremov 6943d03883 [FE, IR] Make expect actual annotations diagnostic message more friendly
Print which annotation exactly has a problem instead of
printing whole declarations with all annotations.

^KT-58551
2023-08-02 13:12:31 +00:00
Roman Efremov 11ccad7e40 [FE, IR] Add expect actual annotations incompatibility info into diagnostic
This is needed for more beautiful reporting and easier
implementation of quick fix in IDE.

^KT-58551
2023-08-02 13:12:31 +00:00
Roman Efremov a64bac0b8c [FE] Refactor: differentiate two types of problems in annotation checker
This is needed for more beautiful reporting and easier
implementation of quick fix in IDE.

^KT-58551
2023-08-02 13:12:31 +00:00
vladislav.grechko 75bef4050e Minor: rename method in JvmSymbols.kt
Rename createJavaPrimitiveClass ->
createJavaPrimitiveClassWithUnsignedUtils.
2023-08-02 10:48:22 +00:00
vladislav.grechko cfcdc6f0ae [JVM_IR] Box primitive types in class literals of reified type arguments
Bytecode inliner boxes primitive types in class literals of reified type
arguments. This is by design, and we should backport this behaviour to
IR inliner.

^KT-60144: Fixed
2023-08-02 10:48:22 +00:00
Kirill Rakhman ade1354a84 [FIR] If callable reference can't be resolved with expected type, try resolving with Any
In positions outside of calls (e.g. property initializers)
we resolve callable references using a synthetic outer call with the
expected type as parameter type.
If this fails, we previously returned an unresolved reference.
After this commit, we additionally try to resolve the callable reference
with expected type Any.
This lets us report more precise diagnostics like type mismatches or
when multiple overloads exist NONE_APPLICABLE.

#KT-55373 Fixed
#KT-55955 Fixed
2023-08-02 08:00:33 +00:00
Dmitriy Novozhilov 2c91ae1129 [Test] Report backend diagnostics from dependant MPP modules for FIR codegen tests 2023-08-02 07:53:26 +00:00
Dmitriy Novozhilov 48c148473f [Test] Report backend diagnostics in JVM codegen tests 2023-08-02 07:53:26 +00:00
Sebastian Sellmair b5e80fe060 [Gradle] KotlinMultiplatformSourceSetConventions: Do not configure source sets in 'lazy' context
As source sets are not lazy. This avoids unnecessary exceptions
in user buildscripts.

^KT-60842 Verification Pending
2023-08-02 07:44:19 +00:00
Zalim Bashorov fe0629ff8a Regenerate tests 2023-08-02 00:03:49 +02:00
Zalim Bashorov d2f537ede5 [JVM] Mute nestedCallsWithGenericToInt for IR inliner tests 2023-08-01 23:48:24 +02:00
Zalim Bashorov 8452e4732e [Wasm] Unmute typedDelegation test 2023-08-01 23:48:24 +02:00
Zalim Bashorov cac5342add Generate tests 2023-08-01 23:48:24 +02:00
Zalim Bashorov acc3dc0daa [Wasm] Take into account nullability for primitives while recovering a stack type
#KT-60496 Fixed
2023-08-01 23:48:24 +02:00
Zalim Bashorov 141645c5d7 [Wasm] Generate proper code in stack type recovering:
* When the actual type is some nullable type but nullable `Nothing` is expected.
* Respect nullability when casting reference types.

#KT-60113 Fixed
2023-08-01 23:48:23 +02:00
Zalim Bashorov 1946476e58 [Wasm] Generate comments for inlined calls 2023-08-01 23:48:23 +02:00
Ilya Goncharov 3450e60a1f [Gradle, Wasm] Fix test data for wasm js test 2023-08-01 19:48:36 +00:00
Igor Yakovlev 5e14ccbccc [Wasm] Backend support for wasi mode 2023-08-01 18:47:38 +00:00
Alexander Shabalin 22a3000789 [K/N] Make a stress test faster with aggressive GC 2023-08-01 16:25:51 +00:00
Alexander.Likhachev 61f404e493 [BT] Implement incremental compilation within the daemon
#KT-57398 In Progress
2023-08-01 16:24:37 +00:00
Alexander.Likhachev 91dc33f398 [IC] Allow to not specify the root project dir
When it's specified, it's used to calculate relative paths
2023-08-01 16:24:37 +00:00