Commit Graph

105942 Commits

Author SHA1 Message Date
Ivan Kochurkin 54ab3d39db [FIR] Fix crash on incorrect call on ILT
^KT-62306 Fixed
2023-11-08 10:27:44 +00:00
Kirill Rakhman c5da2b7433 [FIR] Rename FirElementSerializer.containingDeclaration to currentDeclaration for clarity 2023-11-08 10:26:34 +00:00
Kirill Rakhman 7da271bab8 [FIR] Serialize context receivers using the correct local serializer
This leads to type ref referring to generic type variables being
serialized correctly.
When the type variable is declared on the member itself, it's written to
typeParameterName,
otherwise it's written to typeParameter. This is required for
deserialization to work correctly.

#KT-63227 Fixed
2023-11-08 10:26:34 +00:00
Alexander Shabalin fe94876d9a [K/N] Fix handling custom llvm and libffi distributions ^KT-63220 2023-11-08 09:24:20 +00:00
Kirill Rakhman eba1fdec1d [Tests] Check for duplicate file names in FIR diagnostic tests with IR
The relative path of a test file is just its name, even if it's in a
module.
Diagnostics in IR are mapped to the file path and so it's reported on
all files with the same path, i.e. name.
This doesn't happen in production code because no two files can have
the same path.

The proper fix would be to prefix the test files' paths with the module
name.
Unfortunately, this breaks a bunch of test runners that rely on the
current behavior.
Especially, some JS runners turned out to be hard to fix.
The linked YouTrack issue contains a WIP, incomplete patch of fixing
some runners.

#KT-61592 Fixed
#KT-63252
2023-11-08 08:25:19 +00:00
Marco Pennekamp 159d89b7af [FIR] Remove obsolete for loop in FirConflictsDeclarationChecker 2023-11-07 21:18:43 +00:00
Nikita Bobko 45c5fd7a2d [FE] Introduce a language feature entry for expect actual classes
^KT-62885 Fixed
2023-11-07 20:05:59 +00:00
Vladimir Sukharev 4d4ad6c0d8 [K/N] Fix K2 ObjC interop: Fields are not supported for Companion of subclass of ObjC type
^KT-63048
2023-11-07 18:51:10 +00:00
Vladimir Sukharev 3ea4a6a937 [K/N] Add test for KT-63048, K1greenK2red
^KT-63048
2023-11-07 18:51:10 +00:00
Aleksei.Glushko b6639ae128 [K/N] Fork concurrent-mark-and-sweep GC sources 2023-11-07 17:20:12 +00:00
Aleksei.Glushko 8726608973 [K/N] Move parallel-mark-concurrent-sweep GC sources 2023-11-07 17:20:12 +00:00
Ilya Gorbunov 48ce45e22f [stdlib] Fix outdated documentation in Kotlin-Java Duration conversions
Add tests for documentation statements
2023-11-07 16:25:06 +00:00
Nikita Bobko 7b8445f914 [FIR] 2/2 Support more wider actual member visibility, if the expect member is effectively final
^KT-61955 Fixed

Introduce LV vs don't introduce LV:

introduce LV:
- K1 IDE and K2 project: IDE accurately shows compiler errors
- K2 IDE and K1 project: There are cases when IDE shows red but in reality it's green

don't introduce LV:
- K1 IDE and K2 project: There are cases when IDE shows red but in reality it's green
- K2 IDE and K1 project: There are cases when IDE shows green but in reality it's red
2023-11-07 15:53:54 +00:00
Nikita Bobko e13ebe8474 [FIR, IR] 1/2 Refactoring: propogate LanguageVersionSettings to areCompatibleCallableVisibilities
This refactoring is needed for KT-61955
2023-11-07 15:53:54 +00:00
Nikita Bobko dfe048a96a [FIR] Cleanup: drop unused ExpectActualMemberDiff
- It became unused after cc70f78027
- And it's not going to become used in the nearest future, since in K2,
  we won't have "member scopes" check on frontend (for now)
2023-11-07 15:11:49 +00:00
Aleksei.Cherepanov 431f77ddb4 Disable mappings dump creating for JPS graph
Disable mappings dump for tests when JPS graph implementation is enabled
2023-11-07 13:49:43 +00:00
Anastasia.Nekrasova 93ebd83ecd [K2] Disappeared OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN (4)
Added checking usages of markers as qualifiers in properties and function calls.

^KT-59998
2023-11-07 13:12:46 +00:00
Anastasia.Nekrasova 72d69e16c4 [K2] Disappeared OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN (3)
Added checking usages of markers as qualifiers in imports.

^KT-59998
2023-11-07 13:12:46 +00:00
Anastasia.Nekrasova 97f09acc92 [K2] Disappeared OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN (2)
Added checking usages of markers as qualifiers.

KT-59998
2023-11-07 13:12:46 +00:00
Anastasia.Nekrasova 445ed7abc9 [K2] Disappeared OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN (1)
Added error propagation for the type-aliased type.

^KT-59998
2023-11-07 13:12:46 +00:00
Dmitriy Novozhilov 5c7b586dbb [FIR2IR] Mark ownerIfBound function as @UnsafeDuringIrConstructionAPI
Usages of this function may lead to potentially error-prone behavior,
  so it should be used carefully
There is a probability that this function won't be needed after
  KT-62856 will be fixed
2023-11-07 13:00:41 +00:00
Dmitriy Novozhilov 3ae2a8387e [FIR2IR] Remove incorrect usages of Fir2IrDeclarationStorage.getOrCreateIrConstructor
See comment to the similar commit about `getOrCreateIrFunction`

There are two added TODOs mentioned KT-62856, without them the following
  tests are failing:
- `FirPsiJvmIrTextTestGenerated.FirProblems#testTypeParameterBounds`
- `FirPsiJvmIrTextTestGenerated.Declarations#testKt52677`
2023-11-07 13:00:41 +00:00
Dmitriy Novozhilov bced604b57 [FIR2IR] Remove incorrect usages of Fir2IrDeclarationStorage.getOrCreateIrFunction
`getOrCreateXxx` methods have not very safe semantics: they sometimes
  create an IR declaration if it was missing in caches before. For all
  source declarations, this is not very good semantic, because we have
  strict rules in which order source declarations should be created,
  and usage of `getOrCreateXxx` may break this order.
So it's important to be able to track all invocations of such methods
  to ensure that it's appropriate in each case.
To achieve that, a new `@GetOrCreateSensitiveAPI ` opt-in is introduced
2023-11-07 13:00:41 +00:00
Dmitriy Novozhilov af6b71ca2d [FIR2IR] Slightly cleanup some fir2ir classes 2023-11-07 13:00:41 +00:00
Dmitriy Novozhilov 2ba7194467 [FIR2IR] Make most field-related functions of Fir2IrDeclarationStorage return symbols
This is a preparation to introducing unbound symbols in fir2ir conversion
2023-11-07 13:00:41 +00:00
Dmitriy Novozhilov 429010d70e [FIR2IR] Convert return expressions using symbols instead of IrFunction 2023-11-07 13:00:41 +00:00
Dmitriy Novozhilov a38d60b275 [FIR2IR] Make most functions of Fir2IrDeclarationStorage return symbols instead of IR elements
This is a preparation to introducing unbound symbols in fir2ir conversion
2023-11-07 13:00:41 +00:00
Dmitriy Novozhilov d08567c2c7 [FIR2IR] Approximate extension receiver type after type argument substitution
Frontend may leak captured types into type arguments, so they should be
  approximated before using them in fir2ir cast inserter to determine
 a specific type from smartcast

^KT-62863 Fixed
2023-11-07 12:37:19 +00:00
Alexander Udalov d2ebaf4e6c Minor, add regression test for K2 delegation issue
#KT-62120
2023-11-07 12:30:45 +00:00
Sebastian Sellmair 5506384cc9 [Gradle] Remove unused KotlinTargetConfigurator.configurePlatformSpecificModel
KT-61634
2023-11-07 12:29:31 +00:00
Sebastian Sellmair b347ff2c53 [Gradle] Migrate KotlinNativeTargetConfigurator.warnAboutIncorrectDependencies to KotlinGradleProjectChecker
KT-61634
2023-11-07 12:29:31 +00:00
Sebastian Sellmair faecd7f772 [Gradle] Implement KotlinNativeTargetConfigurator.registerEmbedAndSignAppleFrameworkTasks as EP as side effects
KT-61634
2023-11-07 12:29:31 +00:00
Sebastian Sellmair 9b47c98ce9 [Gradle] Implement KotlinNativeTargetConfigurator.createCInteropTasks as EP based side effects
KT-61634
2023-11-07 12:29:31 +00:00
Sebastian Sellmair 8651d67aeb [Gradle] Implement ConfigureFrameworkExportSideEffect
KT-61634
2023-11-07 12:29:31 +00:00
Johan Bay 3aeca1956e [K/N] Consolidate toolchain paths between platforms
The compiler had some code that looked for the same tools and files
in toolchains at different relative paths depending on the platform.

This commit improves that code by including `usr/` into the path to
the toolchain on macOS, which allows to unify the relative paths
inside the toolchains.

Co-authored-by: Johan Bay <jobay@google.com>
2023-11-07 12:10:14 +00:00
Pavel Punegov 0d8960088e [K/N] XCTest launcher for CompilerOutput's TEST_BUNDLE
This change adds a Native Obj-C launcher that implements XCTestCase
and overrides defaultTestSuite property to provide XCTest with generated
test suites and test cases.

The defaultTestSuite method is essentially a starting point with runtime
initialization. It requires a `Konan_create_testSuite()` method to be
implemented in a Kotlin library that returns a list of XCTestCases.

This launcher should be compiled as a TEST_BUNDLE to be used then with
XCTest.

This commit is a part of ^KT-58928


Co-authored-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>

Merge-request: KT-MR-12841
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-11-07 11:56:08 +00:00
Nikita Bobko d6acba1c33 Add regression tests for final expect classes overrides that change modality
KT-61840
Specifically see the comment:
https://youtrack.jetbrains.com/issue/KT-61840/K2-support-changes-in-overrides-of-fake-overrides-of-expect-declarations#focus=Comments-27-8077580.0-0

Review: https://jetbrains.team/p/kt/reviews/12147/timeline
2023-11-07 10:24:35 +00:00
Egor Kulikov 408e2f109f [FIR] Correctly process slash in class name in ClassId
^KTIJ-27358 fixed


Merge-request: KT-MR-12673
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-07 09:47:05 +00:00
Dmitrii Gridin 1173cc46e2 [Analysis API] add constructorSymbol to API of KtAnnotationApplicationWithArgumentsInfo
This is required for some checks on call site, and it seems that
this symbol can cover all cases.
One of the examples why this API was introduced is a request to
distinguish which vararg parameter is missed in arguments
of an annotation call from symbol light classes

^KT-62560
2023-11-07 09:06:00 +00:00
Ilya Goncharov 3a6cdc83cf [Gradle, JS] Use KotlinJsIrCompilation with deprecated KotlinJsCompilation
^KT-41382 fixed
2023-11-07 08:48:50 +00:00
Alexander Shabalin 4c36538646 [K/N] Add signposts to safepoints ^KT-62689
Disabled by default.

Merge-request: KT-MR-12679
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-11-06 23:10:08 +00:00
Brian Norman b309786353 [FIR] RHS assignment during equality comparison should invalidate DFA
If the right-hand side of an equality comparison contains an assignment
to the variable used in the left-hand side, then implications about the
equality comparison within data-flow analysis cannot be applied, as the
value of the variable will be different after the comparison.

^KT-55096 Fixed
2023-11-06 22:12:22 +00:00
Ilya Chernikov 879f0eff71 Fir: Print origin of the generated diagnostics
similar to other generated entities by now.
2023-11-06 21:21:16 +00:00
Ilya Chernikov 1ad4f19181 Fix default positioning strategy handling
that causes flaky tests because the default positioning strategy
was dependent on the order of the reported messages.
The code led to it was introduced in an attempt to extract common
PSI-independent strategy because PSI is leaking into the abstract
diagnostic infrastructure. The approach is definitely problematic,
but to fix it now, the leaking dependency to the psi-based module
is introduced. This should be fixed in the future by introducing
better abstractions.
Fixes flaky tests touched in the commit.
#KT-63002 fixed
2023-11-06 21:21:16 +00:00
Dmitriy Dolovov 0de04f934e [Commonizer] Switch from trove4j to fastutil
^KT-63159
2023-11-06 19:56:17 +00:00
Dmitriy Dolovov 7658b818ac [Commonizer] Add a performance test (muted by default)
This test can be used to make small performance measurements of
the core commonizer on occasional basis. This test is not intended
for regular execution, e.g. at the CI server.

^KT-63159
2023-11-06 19:56:17 +00:00
Evgenii Mazhukin 20af98c776 [Tests] Re-enable K1 IC tests for expect-actual
^KT-60831 fixed
^KT-60831 next step KT-63183


Merge-request: KT-MR-12855
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-11-06 19:46:43 +00:00
Nikita Bobko 4050285fef Drop unnecessary suppress from stdlib
^KT-62785 Fixed
Review: https://jetbrains.team/p/kt/reviews/12858/files
2023-11-06 19:00:35 +00:00
Dmitrii Krasnov aad19ab844 [Gradle, Native] Override equals and hashCode in KonanTarget
"data objects" is only available since language version 1.9. But we should not use LV 1.9, because it is used in the Gradle build classpath and would be incompatible with Gradle Kotlin runtime.
Then only manually override equals/toString/ works here.

#KT-61657 Fixed


Merge-request: KT-MR-12759
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2023-11-06 18:55:40 +00:00
Dmitrii Krasnov f8507d5220 [Gradle, Native] Switched downloading k/n to from Maven Central in KGP
#KT-62907 Fixed
2023-11-06 16:50:43 +00:00