Commit Graph

101619 Commits

Author SHA1 Message Date
Denis.Zharkov 442844f165 K2: Fix false-positive overload ambiguity after smart cast
Mostly, the change is just mirroring the same logic from K1
OverloadingConflictResolver

^KT-58524 Fixed
2023-05-11 15:01:37 +00:00
Denis.Zharkov efdecc63cb K2: Make filterOutOverridden helper satisfying its contracts
It's obviously expected that all overridden, not only direct ones
are considered

While it likely changes the behavior and some tests are expected to be
changed, original intention was to fix the behavior for other usages
(see later commits) and the part with tests are postponed with KT-58636

^KT-58636 Related
2023-05-11 15:01:37 +00:00
Sebastian Sellmair 85059ced93 [Gradle] Split KotlinPluginLifecycle and KotlinPluginLifecycleImpl
^KT-58255 Verification Pending
2023-05-11 14:13:10 +00:00
Sebastian Sellmair 7910e0d32c [Gradle] KotlinPluginLifecycle: Demote .enqueue to implementation
As .launch shall be the only entry point for running code
within the context of the KotlinPluginLifecycle

^KT-58255 Verification Pending
2023-05-11 14:13:10 +00:00
Sebastian Sellmair b53bf4b148 [Gradle][Minor] runLifecycleAwareTest: Prefer re-throwing AssertionError
^KT-58255 Verification Pending
2023-05-11 14:13:10 +00:00
Sebastian Sellmair 0ab0788763 [Gradle] Lifecycle: Remove LifecycleAwareProperty
Replaced by just keeping the 'awaitFinalValue()' function

^KT-58255 Verification Pending
2023-05-11 14:13:10 +00:00
Dmitrii Gridin 09dbae5eca [LL FIR] add more restrictions to getNonLocalContainingOrThisDeclaration
^KTIJ-25437
KT-MR-10036
2023-05-11 16:09:02 +02:00
Alexander Udalov ff65324172 JVM: use a safer version of fileParent for Java declarations
Java declarations do not have a file parent, their outer element is
IrExternalPackageFragment.

The test did not fail in K1 only by accident, because there's an extra
IrTypeOperatorCall on the property reference's dispatch receiver, which
automatically makes it non-inlinable. In K2, it's IrGetField, so we were
trying to compute if its dispatch receiver is inlinable and for that we
tried to get its fileParent, which resulted in exception if it comes
from Java.

Also refactor PropertyReferenceDelegationTransformer.canInline a bit.

 #KT-57955 Fixed
2023-05-11 13:17:34 +00:00
Kirill Rakhman e2dafdb5b9 [Native/Tests] Add explicit import for SharedImmutable
This fixes an overload resolution ambiguity in K2.

#KT-56272
2023-05-11 13:10:34 +00:00
Simon Ogorodnik 471be7405a FIR. Remove effectively unused parameter to resolveArgumentExpression
The only place where it was used was revised input type logic for lambda
analysis, and it turns out the only significant information it carries
is the presence of expected type ref, which is in fact equal to such of
an expectedType argument
2023-05-11 12:56:55 +00:00
Artem Kobzar 669efc781d [K/JS] Import @JsModule declarations without asterisk 2023-05-11 12:39:57 +00:00
Alexander Korepanov 1920bbde07 [K/JS] Enable partial linkage tests 2023-05-11 12:37:01 +00:00
Artem Kobzar 302623c388 [K/JS] Skip static members in fake overrides generating ^KT-58396 Fixed 2023-05-11 12:32:21 +00:00
Mikhail Glukhikh 134284e496 FE: add test for KT-58055 2023-05-11 12:19:40 +00:00
Sebastian Sellmair 42109725ed [Gradle] Implement AndroidSourceSetLayoutV1SourceSetsNotFoundErrorTest
... to cover KT-58488
2023-05-11 12:05:13 +00:00
Sebastian Sellmair 484863d8c6 [Gradle] Implement AndroidSourceSetLayoutV1SourceSetsNotFoundChecker...
... in order to provide better guidance for projects
migrating to Multiplatform/SourceSetLayout v2 which will suffer from
`UnknownDomainObjectException` when requesting old Android source sets
like

```
sourceSets.getByName("androidTest") // renamed to androidUnitTest
sourceSets.getByName("androidAndroidTest") // renamed to androidInstrumentedTest
```

^KT-58488 Verification Pending
2023-05-11 12:05:13 +00:00
Pavel Mikhailovskii 25c0725da9 [SLC] Treat error class types as not-nullable 2023-05-11 11:48:45 +00:00
Yahor Berdnikau bdad2e5c88 [Gradle] Fix Kotlin native compilation exposed compiler options type
^KT-57815 Fixed
2023-05-11 10:51:40 +00:00
Yahor Berdnikau cc9325eb5b [Gradle] Stop using flow control to locate Gradle task
^KT-57052 Fixed
2023-05-11 10:39:53 +00:00
Dmitrii Gridin 9a267176f5 [FIR] move deprecation calculation to COMPILER_REQUIRED_ANNOTATIONS phase
Also, this change adds SinceKotlin and Java.Deprecated to this phase
It fixes some problems with API_NOT_AVAILABLE, so now it is closer to K1

^KT-57648 Fixed
^KT-55723 Fixed
2023-05-11 10:31:52 +00:00
Dmitrii Gridin add47aa041 [FIR] provide correct origin and source to default backing field
Now it is aligned with default accessors
Covered by
analysis/analysis-api/testData/symbols/symbolByReference/accessorField.kt
test

^KT-57648
^KT-55723
2023-05-11 10:31:52 +00:00
Vladimir Dolzhenko ae4b0c6fe1 Drop KtStubElementTypes#FILE
It has been marked as deprecated for a while and targeted to be deleted in 1.9.0

#KT-53781

Merge-request: KT-MR-10082
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-05-11 09:56:55 +00:00
Igor Chevdar 2f24c6df80 [K/N] Added isSubtype intrinsic 2023-05-11 09:30:18 +00:00
Igor Chevdar 67b65ec56a [K/N] Reformat 2023-05-11 09:30:18 +00:00
Igor Chevdar 96c142569d [K/N] Slight devirtualization improvement
Make devirtualization not by an actual receiver type but rather
by an actual virtual method implementation (which sometimes can be better)
2023-05-11 09:30:18 +00:00
Vsevolod Tolstopyatov 5b474bc5d3 Stabilize EnumEntries stdlib signature
* Also, mention implementation details of EnumEntries to enable safe uses of a 'EnumEntries' as a set
* Fix testdata for opt-in marker in enum entries

^KT-58548 fixed

Merge-request: KT-MR-10037
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-05-11 09:18:44 +00:00
Ilmir Usmanov aec78ab2d8 Minor. Add regression test for KT-42696
#KT-42696 Fixed
2023-05-11 11:15:06 +02:00
Mikhail Glukhikh 9011af1008 K2: perform IOT approximation in completion properly #KT-58520 Fixed 2023-05-11 09:12:26 +00:00
Mikhail Glukhikh 8bc72cb2e5 K2: reproduce KT-58520 in FIR2IR (K2 fails with exception) 2023-05-11 09:12:26 +00:00
Ivan Kylchik d83f6a40fb [K2] Revert commit Pass FirFile to metadata serialization
We will ignore this for now. It is quite painful to bring `FirFile`
in all necessary places.

#KT-57812
2023-05-11 08:22:14 +00:00
Ivan Kylchik 0a5883d867 [IR] Add explicit error in IR type transformer for member access expr
We must generate transform method for `IrMemberAccessExpression` by
hand because of specifics of working with `typeArguments`. But we
also must consider the case that in future we can add new fields in
this element. If it happens, we will see error message.

#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik 961d8a4905 [IR] Rewrite transformer generator to write explicit return type
#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik d75d182b26 [K2] Slightly reformat code 2023-05-11 08:22:13 +00:00
Ivan Kylchik 951e30b683 [K2] Pass FirFile to metadata serialization
This is needed to extract correct const value from `ConstValueProvider`.

#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik d26e3871ba [K2] Support interpretation of values in type annotations
#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik 846ad95c9e [K2] Return from toConstantValue only if expected type match
There was a bug with early return from `toConstantValue`
method when we found any const value in `ConstValueProvider`.
Actually we should return only if expected type match. This error can
occur if annotation and constant inside it are fakes and
have the same offset.

#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik 01749a910b [IR] Add new visitor IrTypeVisitorVoid that can traverse IR types
#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik 55cac9caa6 [IR] Separate IrConstTransformer into two distinct classes
The first one `IrConstExpressionTransformer` is responsible for
transforming ordinary expressions and the second one
`IrConstAnnotationTransformer` is responsible for annotations.

#KT-57812
2023-05-11 08:22:13 +00:00
Yahor Berdnikau ccbca7a019 [Gradle] Move pm20 interfaces from plugin/api into plugin codebase
^KT-58619 Fixed
2023-05-10 23:27:14 +02:00
Yahor Berdnikau ac2d00916c Fix toolchain does not configure project level jvm target convention
Now JDK toolchain configures project level compiler options jvm target
convention and does not override convention for task.

For use case when toolchain is configured via task DSL jvm target
convention overrides project level convention.

^KT-57393 Fixed
2023-05-10 20:54:03 +00:00
Dmitrii Gridin aa5261395e [LL FIR] allow parallel resolve for non-jumping phases
^KT-56550 Fixed
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 7f778eafa5 [LL FIR] add missing declarations transformations for COMPILER_REQUIRED_ANNOTATIONS phase
The transformed does nothing previously

^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 231c59bd2c [LL FIR] drop redundant lazy annotations calculation from ANNOTATIONS_ARGUMENTS_MAPPING phase
They must be calculated on the previous ARGUMENTS_OF_ANNOTATIONS phase

^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin a429367890 [LL FIR] unify annotation transformers
^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 5ebba92a6e [LL FIR] FirLazyBodiesCalculator: do not calculate annotations during body calculation
All annotations must be calculated on the corresponding phases

^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 6b8b5c256d [LL FIR] FirLazyBodiesCalculator: cleanup naming
^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 64c2ba1a2a [LL FIR] calculate lazy annotations only for target declaration
To avoid visiting not locked declarations

^KT-56550
^KT-58495 Fixed
^KT-58500 Fixed
^KT-58493 Fixed
^KT-58496 Fixed
^KT-58497 Fixed
^KT-58499 Fixed
^KT-58491 Fixed
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 5c8045f3d0 [LL FIR] add test on nested declarations and annotations
To see the effect of subsequent changes

^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 990f23a11b [LL FIR] FirLazyBodiesCalculator: covert non-public api to private functions
^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin a7692ba2c5 [LL FIR] do not calculate lazy body recursively by default
To avoid visiting not locked declarations

^KT-56550
2023-05-10 17:17:45 +00:00