Commit Graph

105542 Commits

Author SHA1 Message Date
Sergej Jaskiewicz f2bb988e68 [FIR/IR generator] Replace getTypeWithArguments with a property
The `notNull` of that method was never used.
2023-10-20 10:49:20 +00:00
Sergej Jaskiewicz de4e39906c [FIR/IR generator] Use TypeRef for working with types in fields
- Don't inherit `AbstractField` from `Importable`, because it really
  is not
- Remove the `arguments` and `nullable` properties from `AbstractField`.
  Both properties can be derived from the field's `typeRef`.
- Make `AbstractField`'s `typeRef` property of type
  `TypeRefWithNullability` instead of just `TypeRef`, because fields
  can always be nullable.
2023-10-20 10:49:20 +00:00
Sergej Jaskiewicz f30bf0e7e2 [FIR generator] Remove unused customType property from SimpleField 2023-10-20 10:49:20 +00:00
Pavel Kirpichenkov 770332152b [LL] Don't register Java components for built-ins of non-JVM modules
This is the cause for the 'missing dependency supertype: Serializable'
issue: symbols from built-ins will have the additional Serializable
supertype provided by FirJvmDeserializationExtension that shouldn't
be used for non-JVM. In regular modules it is correctly not added by
the non-JVM sessions, leading to difference in supertypes and the error.

KTIJ-27449
2023-10-20 10:35:13 +00:00
Nikolay Krasko bd49df9878 Update intellij platform 213.7172.25 -> 213.7172.53 2023-10-20 10:10:47 +00:00
Pavel Kunyavskiy cf230525c5 [Code Owners] Update CODEOWNERS file with the new common backend team 2023-10-20 09:43:59 +00:00
Dmitrii Gridin 0b45c6ce23 [FIR] FirScriptConfiguratorExtensionImpl: provide source for script parameters
We need this source to be able to find the parent declaration

^KT-62693 Fixed
2023-10-20 09:27:21 +00:00
Dmitrii Gridin 17ab005668 [Analysis API FIR] KtSymbolContainingDeclarationProvider: support script declarations
This commit also fixes a missing symbol for KtScriptInitializer
and some symbol pointers
Many tests marked as 'DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE'
due to KtFirFileSymbol#createPointer logic – the pointer can
be created only for PSI

^KT-61451
^KT-61887
^KT-62626 Fixed
^KT-62693
2023-10-20 09:27:21 +00:00
Dmitrii Gridin d689c1a38f [FIR] FirJavaFacade: fix contract violation from annotations
`isJavaDeprecatedAnnotation` can't be used here because it triggers
the resolution of an annotation ClassId

^KT-62705 Fixed
2023-10-20 09:24:43 +00:00
Alexander Udalov 931c2ce47a Reflection: fix calling suspend fun returning value class over primitive
#KT-47973 Fixed
2023-10-20 08:50:26 +00:00
strangepleasures 6a2cea8a8e [KAPT4] KT-62097 Keep import statements for unresolved annotation classes 2023-10-20 08:33:17 +00:00
Alexander Udalov 731a1dd98d FIR: remove unused copy of CONFLICTING_JVM_DECLARATIONS
It was added as a placeholder in f3c58a1df7 and was not used anywhere.
The used error is declared in `JvmBackendErrors` and is reported by the
backend.
2023-10-20 08:01:59 +00:00
Anton Lakotka 196f14823e [Gradle] Re-use existing nativeDistribution dir
Having a dedicated konan data dir is not working well on Windows
machine. Since invocation of kotlin compiler would make JVM
to load native-specific dlls and it would not be possible to clean them
up until they are unloaded.

^KT-61359 Verification Pending
2023-10-20 07:40:17 +00:00
Sergej Jaskiewicz 75b509c185 [FIR/IR generator] Share visitor-related properties between FIR & IR 2023-10-20 06:41:12 +00:00
Mads Ager bdfb3c3ac9 [Native] Move remaining usages for LLVMBuildLoad to LLVMBuildLoad2.
Step towards LLVM opaque pointers.
2023-10-20 06:07:41 +00:00
Mads Ager 5b9a4b289f [Native] Fix tailrec test.
tailrec is no longer allowed on open functions but this test is
still using it.
2023-10-20 06:07:41 +00:00
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