Commit Graph

101619 Commits

Author SHA1 Message Date
Sergej Jaskiewicz 7abc6af124 [FIR, IR] Fix name mangling for dynamic types
^KT-57566 Fixed
2023-05-25 10:23:33 +00:00
Ivan Kochurkin 994c2229df [FIR] Report UNSUPPORTED_FEATURE for expect/actual members if MPP is disabled
Always enable MultiPlatformProjects for K2MetadataCompilerArguments

 ^KT-57243 Fixed
2023-05-25 09:46:56 +00:00
Ivan Kochurkin 16ed06d4e9 [FIR] Add EXPECT_ACTUAL_MODIFIER positioning strategy 2023-05-25 09:46:56 +00:00
Sebastian Sellmair d8ed7a2820 [Gradle] Run functionalTests in parallel 2023-05-25 09:33:44 +00:00
Kirill Rakhman 4dd1f9f4d6 [FIR] Set type arguments for callable reference in property delegation
#KT-58555 Fixed
2023-05-25 09:27:47 +00:00
Aleksei.Cherepanov bdfc2c33c5 Add missed dependency for JPS serialization
#KTIJ-25610 Fixed
2023-05-25 08:22:11 +00:00
Alexander Udalov 3eb7ac1aac Remove ReflectProperties.lazy, replace with lazy(PUBLICATION)
There's no point in using `ReflectProperties.lazy` over
`lazy(PUBLICATION)`, especially because of the subtle problems the
former can create, such as KT-27585. This is inspired by the fix in
99b38ccb74, although in this case I couldn't come up with an example
that would lead to a runtime exception.
2023-05-24 16:39:45 +00:00
Sebastian Sellmair e0389a0a87 [Gradle] Implement KotlinJvmTarget.mainRun (KotlinJvmRun)
This task will also automatically support the use case of
a 'carrier' task for the IDE. The IDE can use this task
to execute generic main methods, providing a -P<taskName>.mainClass
property

^KT-58661 Verification Pending
2023-05-24 15:00:07 +00:00
Ivan Kochurkin 432c781ff7 [K2, MPP] Fix actualization of fake overrides (fixes a set of bugs in coroutines / ktor)
Split MissingFakeOverridesAdder on FakeOverridesActualizer and ActualFakeOverridesAdder

^KT-57984 Fixed
^KT-58003 Fixed
^KT-58124 Fixed
^KT-57833 Fixed
^KT-58153 Fixed
2023-05-24 14:54:51 +00:00
Dmitriy Novozhilov 58f8e25bfe [JVM IR] Generate mutable lower bound type for flexible IR types 2023-05-24 14:07:33 +00:00
Dmitriy Novozhilov fdc236296d [FIR2IR] Generate @FlexibleMutability annotation on IR types if needed 2023-05-24 14:07:32 +00:00
Ilmir Usmanov a0484de1a6 JVM_IR: Do not copy static init blocks to inline class's constructor
#KT-58593 Fixed
2023-05-24 13:24:47 +00:00
Vladimir Sukharev 74c57e6057 [K2/N] Compile to native binary in two stages
^KT-56855 Fixed

Merge-request: KT-MR-10219
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-05-24 13:07:12 +00:00
Vladimir Sukharev 62901e22ec [K2/N] Turn on IR verification for passed tests
^KT-57716 Fixed

Merge-request: KT-MR-10300
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-05-24 12:23:00 +00:00
Sebastian Sellmair 3b1a7c3ac1 [Gradle] CInteropConfigurations: Support lazy configuration
Using 'whenEvaluated' (aka 'afterEvaluate') is not supported
when using lazy APIs (like register). In order to safely
copy user configuration in both use-cases,
'launchInStage(AfterFinaliseDsl)' is used as this will be safe
either way.

^KT-58838 Verification Pending
2023-05-24 11:45:21 +00:00
Sebastian Sellmair dafe24a3a9 [Gradle] Implement KT58838LazyCinteropConfiguration to cover KT-58838 2023-05-24 11:45:21 +00:00
Alexander Udalov a4121fa8f3 Enable NoSourceCodeInNotNullAssertionExceptions since 1.9
#KT-57570 Fixed
2023-05-24 11:29:51 +00:00
Alexander Udalov ad1dfd5cb9 JVM: change logic of applying KT-57570 behavior a bit
If `-Xno-unified-null-checks` is specified, do not throw exceptions, but
rather revert to the old behavior, with source code in exception
messages.

Note that `-Xno-unified-null-checks` is a flag which enables behavior of
Kotlin 1.3. It can be removed once we no longer support API version 1.3.
2023-05-24 11:29:51 +00:00
Sergej Jaskiewicz 5d3fe7547a [IR] Fix mangling generic properties from IR-based descriptors
For type parameters of generic properties,
`DeclarationDescriptor#getContainingDeclaration` must return
the property descriptor instead of the accessor function descriptor.

^KT-57436 Fixed
2023-05-24 09:58:39 +00:00
Mikhail Glukhikh 5f1976c450 FE: add test for KT-58840 2023-05-24 08:56:21 +00:00
Mikhail Glukhikh 2fcd296db8 FE: fix effective visibility bound calculation logic
#KT-58757 Fixed
#KT-58840 Fixed
2023-05-24 08:56:20 +00:00
Mikhail Glukhikh c130786889 FE: reproduce KT-58757 2023-05-24 08:56:20 +00:00
Pavel Kunyavskiy ee1608ec99 [PL] Make call an exception in case of several inherited implementations
^KT-57701
2023-05-24 08:17:59 +00:00
Vladimir Sukharev fde8909e6f [K2/N] IntegerLiteralType coercion only to unsigned integer types
^KT-57484 Fixed

Merge-request: KT-MR-10270
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-05-24 07:56:14 +00:00
Vladimir Sukharev a534708900 [K2/N] Use FqName to mangle invisible class-like symbol in fake override
^KT-57484

Merge-request: KT-MR-10263
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-05-24 07:34:11 +00:00
Dmitrii Krasnov 548ebbaf90 refactored OsCondition behavior with multiple same annotations on the same target
#KT-51553 In Progress
2023-05-24 06:58:01 +00:00
Justin Paupore dd9e127d2c [Analysis API] Hide FIR-specific diagnostic details.
Change the public-facing KtFirDiagnostic to be an interface, not
a class, and change the internal implementations to be classes, not
interfaces. This allows hiding access to the KtPsiDiagnostic underlying
the AA diagnostic class.
2023-05-23 21:24:02 +02:00
Nikolay Krasko 3eeb867f56 Minor: cleanup warnings in codebase-tests 2023-05-23 16:52:40 +00:00
Nikolay Krasko c1a1986344 Discourage future trove usages
KTI-1135
2023-05-23 16:52:40 +00:00
Dmitriy Dolovov 69a1514b14 [PL] Unmute FIR-based tests that pass now 2023-05-23 16:23:41 +00:00
Dmitriy Dolovov 650a3c467d [PL] Fix: Use stable order of return targets in 'illegalNonLocalReturn' case 2023-05-23 16:23:41 +00:00
Dmitriy Dolovov 1536bca1bb [PL] Handle illegal fun interface SAM conversions
^KT-53967
2023-05-23 16:23:41 +00:00
Dmitriy Dolovov 7f4d9ddde5 [PL] Optimization: Avoid excessive type checks in IR type operators 2023-05-23 16:23:41 +00:00
Nikolay Lunyak 00e8dc1c39 [FIR] KT-58444: Don't run IR generation when compiling native shared
Normally during metadata compilation we use
`K2MetadataCompiler` and it serializes
metadata to klibs without generating IR.

Native shared compilation uses the K2Native
compiler, which generates klibs based on both
the fir and fir2ir information.

It would be nice to reuse `K2MetadataCompiler`
for native shared, but currently it has no
support for the commonizer, and also reads
the stdlib metadata from a jar instead of a
klib, and there's no simple idiomatic way
to pass the `distribution.klib` value down
to `KLibResolverHelper` (native compilation
has some commonized dependencies, and they
explicitly depend on `stdlib`, so we must
resolve it this way or strip it away to be
able to use the metadata jar instead). There
may be other issues, I only digged a bit.

Instead, this change modifies the K2Native
in such a way that it can generate klibs
with metadata without fir2ir info.

Note that this change does not fix KT-58139,
because KT-58139 fails due to performing the
constants evaluation directly during the
metadata serialization when the needed info
does (and, as I was told, should) not exist
(namely, valid property initializers).

^KT-58444 Fixed
2023-05-23 15:59:41 +00:00
Nikolay Lunyak 87cab95713 [FIR] KT-58444: Ensure the compiler crashes 2023-05-23 15:59:41 +00:00
Roman Efremov c8023eac13 [commonizer] Don't commonize "tailrec" and "external" modifiers
expect external and tailrec were prohibited
in previous commit.

^KT-58536
2023-05-23 12:43:51 +00:00
Roman Efremov 439cc88525 [FE] Prohibit expect external and expect tailrec
^KT-58536 Fixed
2023-05-23 12:43:51 +00:00
Stanislav Ruban e6d5df18b8 [tests] Add new (and refactor existing) tests for @SubclassOptInRequired
KT-54617
2023-05-23 12:33:51 +00:00
Toshiaki Kameyama 833edfb209 [IDE] EXPOSED_RECEIVER_TYPE: add quickfix to decrease visibility on the use side
^KTIJ-23267 Fixed
2023-05-23 12:33:31 +00:00
Nikita Bobko 088c25ea41 [Test] Refactor DeferredInit testData to make it more readable
Review: https://jetbrains.team/p/kt/reviews/9967

1. Fix weird indentation in ValDeferredInit*
2. Use meaningful names in ValDeferredInit*
3. Drop leading indentation in VarDeferredInit*. Not everyone has a wide
   monitor
4. Add some NOTICABLE comment that VarDeferredInit* test should be read
   as table
2023-05-23 14:12:29 +03:00
Nikita Bobko 771f82bcf6 [FE] Fix "Not reachable case" exception
Review: https://jetbrains.team/p/kt/reviews/9967

This commit fixes:

    Cause 2: java.lang.IllegalStateException: Not reachable case. We can always suggest making `open val` property `final`
            at org.jetbrains.kotlin.resolve.DeclarationsChecker.reportMustBeInitialized(DeclarationsChecker.kt:845)
            at org.jetbrains.kotlin.resolve.DeclarationsChecker.checkPropertyInitializer(DeclarationsChecker.kt:778)
            at org.jetbrains.kotlin.resolve.DeclarationsChecker.checkProperty(DeclarationsChecker.kt:614)
            at org.jetbrains.kotlin.resolve.DeclarationsChecker.process(DeclarationsChecker.kt:106)
            at org.jetbrains.kotlin.resolve.BodyResolver.resolveBodies(BodyResolver.java:258)

Reproducible in K1 & K2
2023-05-23 14:12:29 +03:00
Nikita Bobko 26e45304e1 [Test] backingField testData: migrate from deprecated directive syntax
Review: https://jetbrains.team/p/kt/reviews/9967
2023-05-23 14:12:29 +03:00
Nikita Bobko de8c3826c2 [FE] Prohibit missed MUST_BE_INITIALIZED when there is no primary constructor
^KT-58472 Fixed
Review: https://jetbrains.team/p/kt/reviews/9967
2023-05-23 14:12:29 +03:00
Nikita Bobko ac40010501 [FE] Prohibit open val deferred initialization
^KT-57553 Fixed
Review: https://jetbrains.team/p/kt/reviews/9967

Other related tests:
- testUninitializedOrReassignedVariables
- testUseOfPropertiesWithoutPrimary
- @TestMetadata("compiler/testData/diagnostics/tests/secondaryConstructors")
- testAugmentedAssignmentInInitializer
- testInitOpenSetter
- testInitOverrideInConstructorComplex
- testPropertyInitializationOrder
2023-05-23 14:12:28 +03:00
Nikita Bobko 38319c55a8 [FE] Replace some MUST_BE_INITIALIZED messages with MUST_BE_INITIALIZED_OR_BE_FINAL
From user point of view it's an improvement in compilation message.

From technical point of view it's an introduction of new compilation
diagnostic.

Review: https://jetbrains.team/p/kt/reviews/9967

I'm going to deprecate `open val` case in the next few commits KT-57553.
But it is always possible to suggest using `final` for `open val` case.
2023-05-23 14:12:28 +03:00
Nikita Bobko d9d4dee582 [FIR] fix false negative MUST_BE_INITIALIZED for deferred init + custom setter case
^KT-58346 Fixed
Review: https://jetbrains.team/p/kt/reviews/9967

BTW this commit accidentaly and partially fixes KT-57553 for K2, because
of a cleaner K2 architecture. I will unify MUST_BE_INITIALIZED behaviour
in K1 and K2 in the next commits
2023-05-23 14:12:28 +03:00
Nikita Bobko 151144bbed [Test] Cover properties deferred initialization with more tests
Review: https://jetbrains.team/p/kt/reviews/9967

I'm going to change the logic in this area in the next few commits
KT-57553. So let's cover the current behaviour with tests.

*.fir.kt tests are not properly formatted because of K1 and K2 different
behaviour. I will fix it in the next commits
2023-05-23 14:12:28 +03:00
Egor Kulikov f432bbad2e Revert "[FIR] Fix error with incorrect destructing declaration"
This reverts commit b47910e86b.
2023-05-23 12:51:43 +02:00
Egor Kulikov b47910e86b [FIR] Fix error with incorrect destructing declaration
^KTIJ-25342 fixed
2023-05-23 12:48:41 +02:00
Alexander Korepanov 6f7fc14695 [JS IR] Enable all K2 klib IC tests 2023-05-23 10:13:26 +00:00