Commit Graph

101950 Commits

Author SHA1 Message Date
Roman Golyshev bccd7bc04a KTIJ-25341 [Analysis API] Visit component calls in import optimizer
N.B. K2 does not require resolved `componentX` functions for the
placeholder variables (`_`), see KT-59504

^KTIJ-25341 Fixed
2023-06-20 10:12:57 +00:00
Alexander Shabalin db2475f41e [K/N] Make STMS use separate threads for GC and finalizers.
Moves GC into a separate thread, and finalizers processing into yet
another thread. This makes STMS more similar to CMS.
2023-06-20 10:08:25 +00:00
Alexander Shabalin 6996e03bc9 [K/N] Build new MM only for targets with threads
Targets without threads are disabled already.
2023-06-20 10:08:25 +00:00
Pavel Kunyavskiy 12455451fc [K/N] Call class static initializer in constructors
^KT-59058
2023-06-20 08:41:11 +00:00
Alexander Shabalin c40bf720d9 [OWNERS] Add Sergey to K/N runtime .mm files owners 2023-06-20 07:21:44 +00:00
Alexander Shabalin a594b6e914 [OWNERS] Replace Pavel with Aleksei in K/N runtime owners 2023-06-20 07:21:44 +00:00
Mikhail Glukhikh d8a20f1975 K2: don't generate Java overridden synthetics for Kotlin get/sets
#KT-59038 Fixed
2023-06-20 07:07:10 +00:00
Igor Chevdar 9e39b7ef87 [K/N] Don't try to stack-alloc arrays of negative size
#KT-59501 Fixed
2023-06-20 06:20:52 +00:00
Igor Chevdar 95bef03d3e [K/N][tests] Added a reproducer for KT-59501 2023-06-20 06:20:52 +00:00
Leonid Startsev 3933242340 Deprecate KmModule.annotations because it is unused and always empty.
It used to store state of `-Xexperimental` Kotlin compilation flag,
but this feature was removed long ago.

#KT-59366 Fixed
2023-06-19 17:54:18 +00:00
Leonid Startsev b919a12274 Restructure KotlinClass(Module)Metadata.write/read:
- Write now returns result (Metadata or ByteArray) directly without re-wrapping it;
- annotationData/bytes is private to avoid unsoundness if external client corrupts it;
- .toXxx() do not throw exceptions anymore and deprecated. Exceptions are thrown only from read/write;
- Instead of toXxx(), properties like .kmClass should be used instead. They're initialized eagerly and return a view without copying.
- KotlinClassMetadata.Unknown is now a data object, as no useful information is exposed

#KT-59365 Fixed
2023-06-19 17:54:18 +00:00
Egor Kulikov 5bb4f469ef [FIR] Do not throw exception on unexpected FIR for constants
^KTIJ-23263 fixed

Merge-request: KT-MR-10699
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-19 17:45:31 +00:00
vladislav.grechko e4f1c10bc1 [JVM_IR] Do not compile-time evaluate apiVersionIsAtLeast in stdlib
Function `apiVersionIsAtLeast` was introduced to be able to have
different inline function content inlined to user code call sites
depending on their api version settings. Thus, it should not be
compile-time evaluated when being called in the body of inline stdlib
function.

^KT-59452: Fixed
2023-06-19 16:24:57 +00:00
Roman Golyshev adab552928 KTIJ-25530 [Analysis API] Correctly collect references to implicitly dispatched callables in Import Optimizer
N.B. There is a case which is not covered ATM due to the bug in the
compiler, see KT-58980

^KTIJ-25530 Fixed
2023-06-19 16:02:09 +00:00
Mikhail Zarechenskiy 060f3fa7c4 Extract diagnostics about class literals with empty LHS
^KT-59152
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy 1153238fd7 Extract diagnostics about references to variables to a separate one
Note that I've left in FIR everything as is to avoid non-trivial
refactoring that is required right now to report more specific diagnostics

 ^KT-59152
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy 9cf40f8c2f Extract diagnostics about 'suspend test' to a separate one
^KT-59152
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy 2dfdd8dcf6 Extract diagnostics about 'sealed fun interface' to a separate one
^KT-59152
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy d772126f2c Extract diagnostics about 'sealed when' to a separate one
^KT-59152
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy c613b312f9 Refactoring: inline single-used method, move checker closer to the usage 2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy ab7ae75f66 Remove unused method
Note that `yield` was allowed since 1.7.0: KT-27750
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy 1df4893a43 Extract diagnostics about an unsupported case of inheritance from Java
^KT-59152
2023-06-19 15:21:32 +00:00
Svyatoslav Scherbina de78f52bc9 Bump Kotlin/Native version to 1.9.20-dev-4192 2023-06-19 13:45:28 +00:00
Evgeniy.Zhelenskiy 2d920df507 [IR] Fix KT-59346, KT-55993
#KT-59346
#KT-55993
2023-06-19 12:36:08 +00:00
Abduqodiri Qurbonzoda e802ee05a7 [K/N] Do not override equals/hashCode for AbstractMutableMap.values collection 2023-06-19 11:41:10 +00:00
Abduqodiri Qurbonzoda 6015e12db8 [K/N] Remove redundant AbstractMutableMap.SimpleEntry 2023-06-19 11:41:10 +00:00
Abduqodiri Qurbonzoda 3be613ced8 [K/N] Use iterator in AbstractMutableList.indexOf/lastIndexOf
Instead of access by index. To avoid performance issues
when the subclass `get(index)` has non-constant time complexity.
It also aligns behavior with JVM.
2023-06-19 11:41:10 +00:00
Abduqodiri Qurbonzoda 60cafc6623 Document the exceptions Iterator throws 2023-06-19 11:41:10 +00:00
Abduqodiri Qurbonzoda 4ae19b2b44 [K/N] Deprecate SharedImmutable annotation #KT-57837
As a part of efforts to stabilize Native stdlib.
2023-06-19 11:35:32 +00:00
Abduqodiri Qurbonzoda 0cfb80144a [K/N] Throwable.printStackTrace() should print to the stderr output
Aligns with the JVM behavior.

As a part of efforts to stabilize Native stdlib.
2023-06-19 11:30:13 +00:00
Dmitriy Novozhilov d972b78627 [FIR] Allow actualization of expect classes by classes with wider visibility
^KT-59355 Fixed
2023-06-19 11:09:32 +00:00
Anna Kozlova 583aad2350 [LL] spare some memory on lists
By default, a list with a single element would have capacity of 10;
in big numbers, it might be a lot of wasted memory.
2023-06-19 10:33:12 +00:00
Ilya Goncharov 0afe712f07 [Gradle, JS] Test on changing of synced files since 7.6 Gradle 2023-06-19 09:14:27 +00:00
Dmitrii Krasnov a5c72925a0 Fixed testSyncFrameworkMultipleArchitecturesWithCustomName
#KT-51553 In Progress
2023-06-19 10:43:46 +02:00
Brian Norman 8ac59592ed [FIR] Add DFA implications when one side of an Elvis operator is null
When one side of an Elvis operator can only be `null`, and the entire
Elvis operator expression cannot be `null`, this implies that the
opposite side of the Elvis operator cannot be `null`. Add such
implications to the Elvis exit node of the DFA. This helps smart-casting
of variables used within long Elvis operator chains.

#KT-49249 Fixed
2023-06-19 08:17:47 +00:00
Nikolay Lunyak 110cc79ddd [FIR] Improve debugging of diagnostic ranges
`UNREACHABLE_CODE` is weird.
If we look into its
positioning strategy,
we'll see that this diagnostic
attempts to split the source
of its element into multiple ranges.
This is bad, because such smaller
ranges can easily overlap with other
diagnostics in such a way that
they are no longer hierarchical.
See the
`compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt` test
for an example of this behavior
(allow reporting `UNREACHABLE_CODE`
first). The problem will appear at
the condition of `case_7`.
2023-06-19 07:40:16 +00:00
Nikolay Lunyak 7541732752 [FIR] Fix TEST SPEC tests
Ensure the test data contents for both the frontends
are identical. This is needed for proper analysis of
K2-differences.
2023-06-19 07:40:15 +00:00
Abduqodiri Qurbonzoda e6633d3d92 [K/N] Document that Throwable.stackTraceToString format is unstable
As a part of efforts to stabilize Native stdlib.

Merge-request: KT-MR-10637
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-06-17 20:15:55 +00:00
Dmitrii Gridin 8cdba7b9e7 [LL FIR] KtFirVisibilityChecker: use getOrBuildFirSafe instead of resolveToFirSymbol againg
It is unexpected, but getOrBuildFirSafe here now works better than resolveToFirSymbol

^KT-59266
^KT-59453 Fixed
2023-06-17 18:04:59 +00:00
Dmitrii Gridin 72c625906f [LL FIR] add tests on ClassIdCalculator 2023-06-17 13:58:24 +02:00
Dmitrii Gridin fc7712148e [LL FIR] avoid ClassId computation to check isLocal 2023-06-17 13:58:24 +02:00
Dmitriy Dolovov 56bebeaf92 [KLIB] Extract "ir_provider" manifest property name as a const val, p.2 2023-06-17 01:00:04 +00:00
Alexander Udalov 04998cff8a Kapt+JVM_IR: fix error on delegation to anonymous object
In kapt stub generation mode, psi2ir does not generate bodies of
declarations. This means that the delegate type was translated into an
IrType which is based on a class which is not generated by psi2ir, thus
leading to an unbound symbol error. The fix is to avoid using anonymous
types for delegate fields in this mode.

 #KT-59211 Fixed
2023-06-16 23:03:39 +00:00
Alexander Udalov fd4e59f279 Kapt+JVM_IR: do not generate bodies of enum entries
#KT-59247 Fixed
2023-06-16 22:48:11 +00:00
Abduqodiri Qurbonzoda 91f0c3c342 Clarify copyToRecursively doc about symlinks #SDP-1816
This MR is the result of the security audit that was conducted for Path recursive functions:
https://youtrack.jetbrains.com/issue/SDP-1816/Security-issues-of-Path-recursive-functions-in-StdLib#focus=Comments-27-7269144.0-0
Eliminates confusions regarding symbolic links.

Merge-request: KT-MR-10245
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-06-16 22:40:56 +00:00
Abduqodiri Qurbonzoda 295fdc36ce Enum.valueOf throws inconsistent exception across multiple platforms #KT-35116 2023-06-16 22:18:20 +00:00
Abduqodiri Qurbonzoda d6867917c9 Enum entry hashCode() should return identity hash code #KT-59223 2023-06-16 22:18:20 +00:00
Timofey Solonin 19c6622ff6 [MPP] Remove obsolete targets from NewMultiplatformIT and ConfigurationCacheIT
^KT-58822
2023-06-16 18:44:03 +00:00
Hung Nguyen 078356164b IC: Fix regression in detecting constants in KotlinClassInfo.kt
A constant is a static final field with non-null value. In a previous
commit (0b09be7), we accidentally removed the *non-null value*
filter when looking for constants in the bytecode.

This commit re-adds that filter to make sure the detection is correct.

Test: Added KotlinOnlyClasspathChangesComputerTest.testDelegatedProperties

^KT-58986: Fixed
2023-06-16 18:40:01 +00:00
Hung Nguyen ff612f15cf IC: Small cleanup in KotlinClassInfo.kt
This is to address the not-yet-resolved comments in
https://github.com/JetBrains/kotlin/pull/5127, plus a few other small
(non-functional) changes.

^KT-58986: In progress
2023-06-16 18:40:00 +00:00