Commit Graph

103388 Commits

Author SHA1 Message Date
Dmitry Savvinov 027fdb86a5 [Gradle] Print diagnostics stacktrace only under --stacktrace or higher
Most of the changes in commit are test-related, as our tests launched
with '-full-stacktrace' by defayult + asserting full stacktrace is
flaky and unreliable

^KT-59774 Fixed
2023-08-03 10:02:25 +00:00
Dmitry Savvinov e334523fd8 [Gradle] Minor: rename verboseDiagnostics -> useParsableDiagnosticsFormat
^KT-59615 Fixed
2023-08-03 10:02:25 +00:00
Alexander.Likhachev 83c53b7ce3 [BT] Implement classpath snapshotting in the Build Tools API
#KT-57565 In Progress
2023-08-03 08:55:32 +00:00
Alexander.Likhachev 329fd6be45 [BT] Move ClassSnapshotGranularity to the Build Tools API module
#KT-57565 In Progress
2023-08-03 08:55:32 +00:00
Alexander.Likhachev 442d1cf711 [BT] Move ClassSnapshotGranularity to the Build Tools API package 2023-08-03 08:55:32 +00:00
Alexander Udalov d4b5599373 Add JVM target bytecode version 21
Unfortunately, there are still problems with running JVM backend tests
with JVM target 21 because:

1) The D8 version that we use does not support bytecode version 21, and
   updating to a newer version requires to change JVM target of compiler
   tests to 11. This will be addressed separately when we enable JVM 21
   in tests-different-jdk.
2) Some tests are failing because of KT-60659 and KT-60770:
   - builtinStubMethods/bridgesForStubs/emptyStringListAdd.kt
   - jdk/stream.kt
   - regressions/kt528.kt

 #KT-60662 Fixed
2023-08-03 08:43:22 +00:00
Alexander Shabalin 5cbf5ad529 [K/N] Fix SP synchronization 2023-08-03 08:13:07 +00:00
Alexander Shabalin d70f891a82 [K/N] Address AtomicStack tsan reports. 2023-08-03 08:09:02 +00:00
aleksandrina-streltsova 9548486b55 [FIR] don't transform analyzed lambda
Inside `transformDeclarationContent` current tower data context is saved. Previously, stored context could be incomplete, because `dataFlowAnalyzer.enterFunction(function)` wasn't called in all cases.
^KTIJ-26419 Fixed
2023-08-03 07:54:24 +00:00
Egor Kulikov 673ac2227a [FIR] Refactor getFir to return only sane option or null
Merge-request: KT-MR-11138
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-08-02 18:24:57 +00:00
Vsevolod Tolstopyatov 64c8ce18a0 Make enumEntries intrinsic public
It is implemented in JVM, JS and Native backends already

^KT-53154 fixed


Merge-request: KT-MR-11355
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-08-02 18:07:51 +00:00
Dmitrii Gridin 77344c0845 [LL FIR] add checks about resolved context receivers
^KT-60728
^KT-60519
2023-08-02 16:50:45 +00:00
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