Commit Graph

106390 Commits

Author SHA1 Message Date
Ilya Gorbunov 2e030f213b [stdlib] Explicit visibility and return types: JVM 2023-11-22 18:04:34 +00:00
Ilya Gorbunov c77930c1ea [stdlib] Explicit visibility and return types: Native 2023-11-22 17:57:40 +00:00
Egor Kulikov 43fc4ccf40 [FIR] Source for implicit iterator calls in for should not be null
^KT-62111 fixed


Merge-request: KT-MR-13029
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-22 17:15:24 +00:00
Roman Efremov 6a90926e2e [K2] Support reporting of IMPLEMENTATION_BY_DELEGATION_IN_EXPECT_CLASS
^KT-59983
2023-11-22 16:40:06 +00:00
Alexander Korepanov bf54fda8ec [JS Test] Add a test case
Add a test case for a suspend lambda
with a user-defined value class.

^KT-62077 Fixed
2023-11-22 16:29:54 +00:00
Roman Golyshev 347d51c90e KTIJ-27879 [AA] Enforce lazy resolve of code fragments in ContextCollector
Without it, the lazy body of code fragment is not properly resolved
and cannot be analyzed

Use the correct function from `BodyResolveContext` to take the scopes
from code fragment into account

^KTIJ-27879 Fixed
2023-11-22 16:29:28 +00:00
Sergej Jaskiewicz 8eefb210f9 [FIR/IR generator] Introduce the shared Model class 2023-11-22 15:10:16 +00:00
Sergej Jaskiewicz 9a11208e67 [FIR/IR generator] Extract visitFunctionName to AbstractElement 2023-11-22 15:10:16 +00:00
Sergej Jaskiewicz 8ba42a7ff2 [IR generator] Use Element#typeName i/o Element#name where needed
This slightly reduces repetition.
2023-11-22 15:10:16 +00:00
Sergej Jaskiewicz 6ac4cd5973 [IR generator] Get rid of the config model
In the IR generator, we had a so-called `ConfigModel` with classes like
`ElementConfig` and `FieldConfig` that we deal with during
tree configuration in `IrTree.kt`, and another kind of model called
just `Model` that included the `Element` and `Field` classes
correspondingly. Those were used for actual code generation.
After configuration, `ConfigModel` was transformed to `Model` and
then the code generation was performed using `Model`.

This architecture is overly complicated and results in massive code
duplication. Most `ElementConfig` and `FieldConfig` properties had
exactly the same counterparts in `Element` in `Field` classes.

So, if you wanted to add a new feature to the tree generator, you had to
add a property to both `ConfigModel` and `Model`.

Turns out we can do just fine with only one kind of model.
2023-11-22 15:10:16 +00:00
Ilmir Usmanov 37417f7919 KAPT: Use reflection to access code, changed in JDK 21
#KT-57389 Fixed
2023-11-22 14:58:55 +00:00
Ilmir Usmanov 4f7c96ae43 KAPT: Always print parens on empty annotation parameters
Since JDK 17+ pretty-printer does not print parens on empty annotation
parameters, print them anyway. Otherwise, tests with annotations differ
on different JDKs.
 #KT-57389
2023-11-22 14:58:55 +00:00
Ilmir Usmanov 87aed4bf47 KAPT: Run tests on JDK 21
Previously, some tests have also been disabled on JDK 11+, since
we did not filter out empty filesets, which led to failed assertion
inside JDK.
 #KT-57389
2023-11-22 14:58:55 +00:00
Ivan Kylchik c82bc8f0ce [WASM] Add ConstEvaluationLowering to the lowering list 2023-11-22 14:54:19 +00:00
Nikolay Lunyak 427c067cd8 [FIR] Forbid typeRef-named labels without +ContextReceivers
^KT-63068 Fixed
2023-11-22 13:22:45 +00:00
Ivan Kylchik e7a3cd638e [JVM_IR] Don't generate reflective access to getter/setter without property
This is the case when we have Java class in hierarchy. In this case,
we want to generate reflective access to the original Java method.

#KT-63642 Fixed
2023-11-22 12:17:01 +00:00
Ivan Kylchik 57d912a5d4 [JVM_IR] Don't use plugin extensions when compiling code fragment
When compiling code fragment, we forbid to use `irLinker` as
IR provider. Because of that, if there are some plugin
extensions, we will not be able to find deserializer
for a given module and will fail.

#KT-63695 Fixed
2023-11-22 11:56:08 +00:00
Nataliya.Valtman 6bbf5b83c8 Add compiler metrics to JPS build report
#KT-63549: Fixed
2023-11-22 11:30:08 +00:00
Vladimir Sukharev 6cff71e7d1 [K/N] Add objc-related clang options to cinterop executable tests
^KT-63287
2023-11-22 11:18:09 +00:00
Dmitrii Gridin d450c1e91f [LL FIR] encapsulate FileAnnotationContainer resolution logic
As a file annotation container is required for resolution,
it should be closer to the resolution logic. Now only LLFirTargetResolver
will operate this logic, so we can change the logic in the future without
a big refactoring.
E.g., as the next step, this resolution can be integrated to the file

^KT-63042
2023-11-22 11:02:09 +00:00
Dmitrii Gridin bc1e9fd2ea [LL FIR] LLFirTargetResolver: introduce resolveDependencyTarget step
This entry point is required to be able to pre-resolve dependency
declarations.
E.g., fake override declaration shares annotation instances between
the original and the fake one, so we should resolve the original
firstly to avoid concurrent modification and correct context.
This will be done later.

This commit effectively only drops body resolution for a file annotation
container if the target element is not a file because this
is not required for correct resolution

^KT-63042
2023-11-22 11:02:09 +00:00
Dmitrii Gridin 0b07b86ec9 [FIR] make FirLazyDeclarationResolver FirElementWithResolveState-based
This is required to be able to call lazy resolve for FirFileAnnotationsContainer

^KT-63042
2023-11-22 11:02:09 +00:00
Sergej Jaskiewicz d7710b8e8d [FIR generator] Remove redundant full qualifier in generated builders 2023-11-22 10:00:06 +00:00
Ivan Kylchik 5edfd6af0f [JVM_IR] Declare type parameters of an outer declaration for code fragment
#KT-63597 Fixed
2023-11-22 09:58:20 +00:00
Alexander Korepanov 45c166abf8 [JS IR] Introduce special setMetadataFor*() for synthetic classes
^KT-63436 Fixed
2023-11-22 09:21:44 +00:00
Alexander Korepanov 9af681e234 [JS IR] Rename metadataUtils.kt -> metadataUtilsOld.kt 2023-11-22 09:21:44 +00:00
Alexander Korepanov 85b2daf41d [JS IR] Add reflection tests 2023-11-22 09:21:44 +00:00
Alexander Korepanov c13cc38758 [JS IR] Remove unused code 2023-11-22 09:21:44 +00:00
Kirill Rakhman 3fe0d3286c [Tests] Mute failing FakeOverrideRebuilder tests after #KT-61282
#KT-63489
2023-11-22 08:46:17 +00:00
Kirill Rakhman 865b8a4175 [FIR] Create special hidden override for Java signature clash due to rename
This fixes CharBuffer.get resolving to CharBuffer.charAt

#KT-61282 Fixed
2023-11-22 08:46:17 +00:00
Kirill Rakhman 528a2d3c62 [FIR] Rename CheckDeprecatedSinceKotlin resolution stage to CheckHiddenDeclaration 2023-11-22 08:46:16 +00:00
Nikolay Lunyak f12ecb3011 [FIR2IR] Avoid converting arguments of dynamic array set twice
^KT-63593 Fixed


Merge-request: KT-MR-13152
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-11-22 07:39:46 +00:00
Anastasia.Nekrasova fb0461f422 [K2] Disappeared UNSUPPORTED_FEATURE (3)
Added a check for the enabled context receivers feature flag for @ContextFunctionTypeParams.

^KT-59913
2023-11-22 06:04:13 +00:00
Anastasia.Nekrasova c04767f1f4 [K2] Disappeared UNSUPPORTED_FEATURE (2)
Added a check for the enabled context receivers feature flag for declaration.

^KT-59913
2023-11-22 06:04:13 +00:00
Anastasia.Nekrasova 685c8e4fe7 [K2] Disappeared UNSUPPORTED_FEATURE (1)
Added a check for the enabled context receivers feature flag for typeRef.

^KT-59913
2023-11-22 06:04:13 +00:00
Alexander Udalov 471f25abfc IR: support buildSimpleType for IrCapturedType
To make it possible to change nullability of IrCapturedType and change
its annotations, which is happening when determining overridability of
functions via IR.

 #KT-63437 Fixed
2023-11-21 20:02:13 +00:00
Alexander Udalov 8379e48e33 IR: remove IrSimpleTypeBuilder.variance
IrCapturedType (which is a IrSimpleType) does not have variance, so it
is confusing to have it in IrSimpleTypeBuilder, and it's clearer to
construct type projection separately anyway.
2023-11-21 20:02:12 +00:00
Alexander Udalov 898d3aeea9 IR: minor refactorings around IrType/IrCapturedType
- use identity in equals/hashCode. It was already effectively working
  like this because of `constructor === other.constructor`
- implement variance and declare it in IrSimpleType
- remove obsolete TODO
- simplify code in captureFromArguments
- use data objects
2023-11-21 20:02:12 +00:00
Alexander Udalov dec41e8c46 Improve muted K2 metadata (kotlinp) tests
Add comments referencing issues where K2 behavior is questionable, and
provide `.fir.txt` versions where behavior is different but fine.
2023-11-21 19:57:10 +00:00
Roman Golyshev f5131d0be2 KTIJ-27730 [AA] Do not shorten constructors of nested classes by default
The relevant tests are in the `intellij` repo

^KTIJ-27730 Fixed
2023-11-21 18:52:57 +00:00
Pavel Kirpichenkov 5729fab8c4 Fix deprecation warning
KTIJ-27752
2023-11-21 18:43:06 +00:00
Pavel Kirpichenkov 645e4af8b1 [IDE] Move KotlinJavaScriptMetaFileDecompiler to kotlin.git
KTIJ-27752
2023-11-21 18:43:06 +00:00
Pavel Kirpichenkov b41c4bc4c1 [IDE] create KotlinLabelProviderService on request
getServiceIfCreated doesn't create a service instance if id wasn't
created before. There are no other service requests for
KotlinLabelProviderService, so it was not used for file types.

KTIJ-27755
2023-11-21 18:43:06 +00:00
Ilya Gorbunov 4d8cf4903c [stdlib] Explicit visibility and return types: DOM API 2023-11-21 18:14:09 +00:00
Ilya Gorbunov ce427b96b3 [stdlib] Suppress explicit api errors in DOM declarations generated by dukat
Suppressions should be removed once dukat supports generating
explicit public visibility and return types
2023-11-21 18:14:09 +00:00
Ilya Gorbunov cfa8a1dc0f [stdlib] Explicit visibility and return types: Wasm 2023-11-21 18:14:09 +00:00
Ilya Gorbunov 381a8fd55f [stdlib] Explicit visibility and return types: JS
Stepping test line number changes are due to changes in coroutineInternalJS.kt
2023-11-21 18:14:09 +00:00
Mikhail Glukhikh 0c61ce61c3 K2: for Java source override, don't compare return types in override checker
#KT-57044 Fixed
2023-11-21 18:11:58 +00:00
Roman Golyshev 7d7256536c KT-63627 [AA] Properly handle object declarations when traversing scopes in KtFirReferenceShortener
`KtClass` denotes only classes, interfaces and enums.
To handle object declarations, we now use
`KtClassOrObject` PSI type

^KT-63627 Fixed
2023-11-21 18:08:43 +00:00
Evgeniy.Zhelenskiy 5096fd266e [FIR] Forbid generic type checks inside contracts in K2 as it is done in K1.
#KT-59922
2023-11-21 18:00:10 +00:00