Commit Graph

101386 Commits

Author SHA1 Message Date
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
Alexander Korepanov 1fb8293968 [JS IR] Change default declaration origin for IC symbols 2023-05-23 10:13:26 +00:00
Alexander Korepanov e4d7897071 [JS IR] Check fir compilation errors after checking IC next round 2023-05-23 10:13:26 +00:00
Alexander Korepanov 28b781f60a [JS IR] Move fir to klib serialization code in separate class 2023-05-23 10:13:26 +00:00
Anton Lakotka effe902c69 [Gradle] fix functional tests after deprecating API
In KotlinDependencyHandler

^KT-58759 Verification Pending
2023-05-23 09:00:30 +00:00
Anton Lakotka c49f08f427 [Gradle] Test type safe project accessors with KotlinDependencyHandler
KT-58759 Verification Pending
2023-05-23 09:00:30 +00:00
Anton Lakotka b3b0f23a50 [Gradle] Deprecate rare api in KotlinDependencyHandler
Recommend users default `project.dependencies` instead.
Gradle's DependencyHanlder has its own evolution thus
we cannot easily maintain API of KotlinDependencyHandler to look like
Gradle's DependencyHandler. We're going to support only our own
factory methods to create dependencies + `project` dependencies.

KT-58759 Verification Pending
2023-05-23 09:00:30 +00:00
Sergej Jaskiewicz 1a29b9efff [FIR, IR] Fix name mangling for functions with context receivers
- Mangled names of property accessors now include context receiver
  types of the corresponding property when computed from FIR.
- Context receivers are now supported when computing mangled names
  from IR
- IrBasedDescriptors now account for context receivers

^KT-57435 Fixed
2023-05-23 08:55:50 +00:00
Artem Daugel-Dauge 5700212119 [Gradle] Fix embedAndSign failire when signing is disable
^KT-50837 Verification Pending
2023-05-23 08:13:25 +00:00
Pavel Kargashinsky 322799f823 [FunctionalTests] Fail tests if androidSDK is not available, not ignore
Tests use kotlin/dependencies/android-sdk, androidSDK should be always available
2023-05-23 07:57:49 +00:00
Pavel Kargashinsky 9449e23538 [FunctionalTests] Fix run ExternalAndroidTargetPropertySmokeTest on Windows 2023-05-23 07:57:49 +00:00
Alexander Udalov 83865782ff FIR: do not generate annotations on properties from delegation
#KT-57228 Fixed
2023-05-22 20:12:29 +00:00
Alexander Udalov 40c628d431 FIR: fix order of property accessor annotations
#KT-57219 Fixed
2023-05-22 20:12:29 +00:00
Alexander Udalov 9c995755f0 Remove obsolete backend test on getter-targeted annotations
`@get:... get` is no longer allowed, see the explanation in KT-15470.
2023-05-22 20:12:29 +00:00
Marco Pennekamp 326b6fa7c2 [AA] Add missing withValidityAssertion calls to scopes
^KT-58653
2023-05-22 19:21:34 +00:00
Egor Kulikov 1d8eb6dc9e [FIR] Only take receiver on lambda if present
^KTIJ-25127 fixed
2023-05-22 17:10:52 +00:00
Brian Norman f149b69df5 Update project icon for Toolbox and IDEA 2023-05-22 17:10:05 +00:00
Karl Wingblade 72e678ad69 KT-52071 Fallback if sys prop read is blocked
If the Java Security Manager blocks reading the system property
`kotlin.ignore.old.metadata`, then continue gracefully with the
default value.
2023-05-22 16:06:56 +02:00
Kirill Rakhman 7a9c516f68 [FIR] Use Throwable as expected type for throw expressions
#KT-58533 Fixed
2023-05-22 14:05:28 +00:00
Igor Chevdar 55632f5df2 [K/N][runtime] Used internal isInstance 2023-05-22 12:49:58 +00:00
Igor Chevdar d1a3752626 [K/N][tests] Fixed lldb tests on arrays 2023-05-22 12:49:58 +00:00
cristiangarcia d32d5346a2 Fix gradle deprecations in Kotlin Native
Merge-request: KT-MR-10267
Merged-by: Cristian Garcia <Cristian.Garcia-Marin@jetbrains.com>
2023-05-22 12:39:57 +00:00
Troels Bjerre Lund 20d8f54ea3 Unlink weakref objects on finalizer-enque ^KT-55364
Co-authored-by: Troels Lund <troels@google.com>

Merge-request: KOTLIN-MR-694
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
2023-05-22 12:16:48 +00:00
Nikolay Lunyak 710a8f4e0f [FIR] KT-58719: Check all imported declarations for visibility
Unfortunately, we have to check
callables even if the class is
inaccessible.

^KT-58719 Fixed
2023-05-22 11:40:30 +00:00
Nikolay Lunyak f446fc4154 [FIR] KT-58719: Ensure the compiler resolves to the class 2023-05-22 11:40:30 +00:00
Denis.Zharkov 67d51eb7ee Add a separate test configurations for JDK 21 dependent test
After it's released, there would be no need in them, but right now
they are unavailable through the toolchain, so we can't require it.
See KT-58765 for tracking

But there should be a dedicated Build configuration with JDK_21_0 env
properly set.

^KT-58716 Fixed
2023-05-22 09:19:52 +00:00
Vladimir Sukharev 4705207263 [K2/N] Fix lost diagnostics
^KT-58065

Merge-request: KT-MR-10264
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-05-22 09:18:04 +00:00
Denis.Zharkov 6b2da2069d K2: Use Any? expected type only for the right argument of == operator
^KT-47409 Fixed
2023-05-22 08:41:55 +00:00
Dmitrii Gridin 447e1711da [LL FIR] do not update phase if exception occurred
Exception (even PCE) can lead to inconsistent situations, for example,
where a function can be marked as resolved, but arguments – not.
Also, in this case, it is possible that the function will be
marked as resolved to TYPES, but not all its type really resolved

^KTIJ-25582 Fixed
2023-05-19 22:59:32 +00:00
Igor Yakovlev 1749bafc30 [Wasm] Rename dateref to structref 2023-05-19 15:50:07 +00:00
Igor Yakovlev 1e0be4e0af [Wasm] Fix null constant typed with external class upperbound 2023-05-19 15:50:06 +00:00
Igor Yakovlev 1c716cee9c [Wasm] Update versions of nodejs, d8 and binaryen 2023-05-19 15:50:06 +00:00
Igor Yakovlev ed1c15b64b [Wasm] Remove redundant code 2023-05-19 15:50:06 +00:00
Igor Yakovlev 6adfd91169 Revert "[Wasm] Revert a7ed496a and few fixes to make Kotlin/Wasm compatible with Firefox"
This reverts commit 1d793f7bec.
2023-05-19 15:50:06 +00:00