Commit Graph

105526 Commits

Author SHA1 Message Date
Mads Ager 72ddd4b78d [Native] Use LLVMBuildLoad2 instead of LLVMBuildLoad.
This is a first step in the move from typed to opaque pointers.
2023-10-20 06:07:40 +00:00
Alexander Shabalin e4b34857c0 [K/N] Fix FrameworkTest with compileOnlyTests. 2023-10-19 21:48:33 +00:00
Anastasia.Nekrasova 4f85cdbaed [K2] Disappeared COMPONENT_FUNCTION_MISSING
^KT-59941
2023-10-19 21:18:01 +00:00
Hung Nguyen fc408125c8 Fix MemoizedCallable in PropertiesBuildService
In commit 5ceebec, the MemoizedCallable instance was created inside the
Provider, which means that the MemoizedCallable is not reused the next
time the Provider is resolved. This was not the intended effect.

In this commit, we will create the MemoizedCallable instance up front so
that each time the Provider is resolved, it will reuse the same
MemoizedCallable and therefore avoid recomputing the value.

Test: Manually verified on the large project in KT-62496
^KT-62496 Fixed
2023-10-19 20:44:59 +00:00
Ilya Chernikov 268d058bbb Implement missing invoke resolution branch with context receivers
#KT-61937 fixed
Note: the current implementation only resolves for a single receiver
in each group. See KT-62712 and KT-62709 for the followup.
2023-10-19 19:39:31 +00:00
Evgeniy.Zhelenskiy b89d8a65a1 [Reflection] Fix parsing JVM function descriptors
#KT-60708
2023-10-19 19:09:31 +00:00
Artem Kobzar df14f044cd [K/JS] Remove unconditional cast to IrClass in KClass expression 2023-10-19 17:34:00 +00:00
Dmitrii Gridin 500de9f9bb [LL FIR] FirElementBuilder: avoid body resolution for type references inside 'where'
^KT-62691 Fixed
2023-10-19 16:24:32 +00:00
Dmitrii Gridin 35567d453b [LL FIR] add lazy resolution tests on 'where' construction
^KT-62691
2023-10-19 16:24:32 +00:00
Sebastian Sellmair f2a2c28ac9 [Gradle] Deprecate org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
... in favor of using Kotlin Gradle Plugin Extension Points

KT-61634
2023-10-19 15:54:35 +00:00
Sebastian Sellmair 7650264de3 [Gradle] Move KotlinMultiplatformPlugin.METADATA_TARGET_NAME to KotlinMetadataTarget
KT-61634
2023-10-19 15:54:35 +00:00
Sebastian Sellmair d5be59a8ec [Gradle] Implement ApplyJavaBasePluginSetupAction
KT-61634
2023-10-19 15:54:35 +00:00
Sebastian Sellmair c47db02d30 [Gradle] Move 'checkGradleCompatibility' to a single, very early invocation
This shall ensure that the compatibility with Gradle
- is always checked for all plugins we ship
- is checked as early as possible

KT-61634
2023-10-19 15:54:35 +00:00
Sebastian Sellmair a15c068471 [Gradle] Implement DeprecatedMppGradlePropertiesMigrationSetupAction
KT-61634
2023-10-19 15:54:35 +00:00
Sebastian Sellmair 3210fdfec4 [Gradle] Inline 'sourceSetFreeCompilerArgsPropertyName' to its use site
KT-61634
2023-10-19 15:54:35 +00:00
Sebastian Sellmair 90230dda60 [Gradle] Implement KotlinMultiplatformTargetPresetAction
KT-61634
2023-10-19 15:54:35 +00:00
Dmitrii Gridin 3817f37011 [FIR] rename ANNOTATIONS_ARGUMENTS_MAPPING phase to ANNOTATION_ARGUMENTS
^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin a86bae2c32 [FIR] drop ARGUMENTS_OF_ANNOTATIONS phase
^KT-62679 Fixed
2023-10-19 14:34:35 +00:00
Dmitrii Gridin 31128deaff [FIR] inline AbstractFirExpressionsResolveTransformerForAnnotations into FirEnumAnnotationArgumentsTransformer
ARGUMENTS_OF_ANNOTATIONS will be dropped, so the previous base class
will be dropped

^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin a60777b9a7 [FIR] move annotation recheck logic to ANNOTATIONS_ARGUMENTS_MAPPING phase
ARGUMENTS_OF_ANNOTATIONS will be dropped, so this check should be moved
This commit also drops class annotations resolution from implicit type
phase and provides the correct scope during argument mapping phase.
This code was effectively unreachable before

^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin 01905a5a06 [LL FIR] move common annotation transformation logic into LLFirAnnotationArgumentMappingLazyResolver
^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin f5763cf34a [LL FIR] move context calculation to CONTRACTS phase
ARGUMENTS_OF_ANNOTATIONS will be dropped, so CONTRACTS is the next one

^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin 32ed81440c [FIR] add missing transformation of annotation type arguments
^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin 27c5a0b60d [LL FIR] add lazy resolve test on conflict of compiler required annotation
^KT-62679
2023-10-19 14:34:35 +00:00
Nikolay Lunyak a0e9cc3206 [FIR] Fix new test data after merging a68a2409 2023-10-19 14:29:24 +00:00
Dmitriy Novozhilov 402e4e3af4 [FIR2IR] Rename some entities in Fir2IrDeclarationStorage
In the previous commit, we started to treat delegated function similarly
  to substitution/intersection overrides, so now it's incorrect to name
  corresponding methods and storages using "fake-override" word

^KT-62671
2023-10-19 13:15:48 +00:00
Dmitriy Novozhilov 940567978d [FIR2IR] Treat delegated functions as fake-overrides
Delegated callables in FIR are session-dependant (as fake-overrides),
  so it's incorrect to use their FIR as a key for declaration storage.
  Pair of original function and owner lookup tag should be used instead

^KT-62671 Fixed
2023-10-19 13:15:48 +00:00
Roman Golyshev 3c68b27280 KT-62071 [AA] Do not throw error from getScopeContextForPosition when implicitScope of receiver value is null
`implicitScope` can be `null`
in case when the implicit receiver resides in a user-defined `kotlin.*`
package, but the user have not yet allowed this with compiler argument
directive.

In this case,
we don't want the IDE to crush and show exceptions - the `kotlin`
package would be highlighted by the compiler diagnostics and other
resolve problems, and that would be enough

^KT-62071 Fixed
2023-10-19 12:59:47 +00:00
Igor Chevdar eb6db02649 Revert "[Native] Use LLVMBuildLoad2 instead of LLVMBuildLoad."
This reverts commit a487ec1889.
2023-10-19 12:57:25 +00:00
Igor Chevdar 254b5b1934 Revert "[Native] Fix tailrec test."
This reverts commit 67c501e0b6.
2023-10-19 12:57:24 +00:00
Igor Chevdar d5001fb7dd Revert "[Native] Move remaining usages for LLVMBuildLoad to LLVMBuildLoad2."
This reverts commit 4e66881549.
2023-10-19 12:57:24 +00:00
Ivan Kylchik 70f195598e [FIR2IR] Don't run interpreter's preprocessors on fir2ir stage
In IR interpreter we have "preprocessors". Preprocessor is a
transformer that changes IR expressions in a way that we can
interpret them at least partially.

We have two places where interpretation is happening:
1. Right after fir2ir where we evaluate only strictly necessary
expression for `const val` and annotations.
2. In lowering for every backend where we are doing some
constant folding.

Earlier, to avoid double work, we didn't launch preprocessors
in backend if we were using K2. But this approach breaks compilation
for MPP projects where one module is compiled with K1 into klib
and the overall project is compiled with K2. On the backend side,
we are mistakenly assuming that preprocessors were launched, but they
were not.

The solution is to run preprocessors only on the backend side. If we
think about it, interpretation on fir2ir doesn't require any
preprocessing because we are working only with expressions that are
correct and must be fully evaluated.

#KT-62126 Fixed
2023-10-19 12:29:32 +00:00
Dmitriy Novozhilov 7ff2fc9dbe Add workaround for KT-62702 2023-10-19 12:13:46 +00:00
Dmitriy Novozhilov 866fbed388 Advance bootstrap to 2.0.0-dev-5387 2023-10-19 12:13:45 +00:00
Pavel Punegov ff89fb8405 [K/N][build] Lazy task configuration in the tests 2023-10-19 12:12:02 +00:00
Pavel Punegov e01cea6669 [K/N][build] Add providers to klib install and cache tasks 2023-10-19 12:12:02 +00:00
Pavel Punegov b1a85d45c6 [K/N][build] Move old Konan plugin to native-build-tools 2023-10-19 12:12:02 +00:00
Sergej Jaskiewicz 04c5ac0eb6 [FIR/IR generator] Factor out adding pure abstract element as parent 2023-10-19 12:00:25 +00:00
Sergej Jaskiewicz 5798021e4b [FIR/IR generator] Refactor element parents
- Move `elementParents` and `otherParents` properties
  to `AbstractElement`
- Use `elementParents` instead of `parentRefs` where needed
2023-10-19 12:00:25 +00:00
Pavel Kunyavskiy 33994d419d [IR] Replace a couple of TODOs with shouldNotBeCalled 2023-10-19 10:16:45 +00:00
Pavel Kunyavskiy da488f513f [IR] Fix file modules after actualization
When files from different IrModules are merged in IrActualizer
their IrModule link was not updated. This led to assuming them
as different modules, and incorrect internal visibility handling.

^KT-62623
2023-10-19 10:16:45 +00:00
Pavel Kunyavskiy ad5831acc6 [IR] Add a method to get ModuleDescriptor from IrPackageFragment
Ideally, instead of this method, there should be a link
to IrModuleFragment. Unfortunately, it would require to big refactoring,
as some of IrPackageFragment implementations doesn't have any
IrModuleFragment inside, and are not located inside any
IrModuleFragment.

So for now, we just implement and use everywhere a single way of
getting the module descriptor, which respects a IrModuleFragment
link if it exists, and fallbacks to descriptor-based method
if it doesn't.

^KT-62623
2023-10-19 10:16:44 +00:00
Vladimir Sukharev 9b9ddb760a [FIR2IR] Coerce last operator in a loop to Unit
One of many fixes for https://youtrack.jetbrains.com/issue/KT-59781/K2-investigate-implicit-cast-generation-in-fir2ir-vs-psi2ir

Merge-request: KT-MR-12629
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-19 09:53:46 +00:00
Ilya Goncharov 5df8ac4d1a [Gradle, JS] Ignore stdout for mocha dry run
^KT-61992 fixed
2023-10-19 09:46:01 +00:00
Nikolay Lunyak a68a2409d3 [FIR] Remove the applicability filtering when reporting diagnostics
In case we don't want to introduce any new
abstractions like "user relevance for
applicability", we can just remove the
filtering.

^KT-62541 Fixed
2023-10-19 09:27:45 +00:00
Nikolay Lunyak fedadfb8db [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
K1 reports `ARGUMENT_TYPE_MISMATCH`
and `TOO_MANY_ARGUMENTS` together, and
one way to do it in K2 is to say that
their kinds of inapplicability difference
is not relevant to the user.

Note that K1 doesn't do such filtering,
so this change "makes K2 closer to K1",
but still different.

^KT-62541 Fixed

fixup! [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
2023-10-19 09:27:45 +00:00
Nikolay Lunyak 06b3c6ec13 [FIR] Reproduce KT-62541 2023-10-19 09:27:44 +00:00
Igor Chevdar 40e8552a8d [gradle] Added a bunch of Gradle IT on K/N incremental compilation 2023-10-19 07:57:36 +00:00
Mads Ager 4e66881549 [Native] Move remaining usages for LLVMBuildLoad to LLVMBuildLoad2.
Step towards LLVM opaque pointers.
2023-10-19 07:54:30 +00:00
Mads Ager 67c501e0b6 [Native] Fix tailrec test.
tailrec is no longer allowed on open functions but this test is
still using it.
2023-10-19 07:54:30 +00:00