Commit Graph

104500 Commits

Author SHA1 Message Date
Kirill Rakhman 2bc25d4f6e [FIR] Properly check for visibility in FirTypeIntersectionScopeContext
This fixes a false positive OVERRIDING_FINAL_MEMBER caused by a
package-private member in a different package being added to the
list of overridden symbols. However, in Java, package-private members
from different packages are effectively like private members in that
they cannot be overridden.

#KT-61696 Fixed
2023-09-12 10:46:46 +00:00
Alexander Udalov d16f33cf5b JVM IR: do not collect all dependency modules in IDE
Collecting all modules takes a lot of time in Evaluate Expression in
IDE, and it's useless because we then invoke JvmIrLinker to load module
headers, but that linker is discarded in the IDE (see `val irProviders`
below).

 #IDEA-329915
2023-09-12 09:11:44 +00:00
Yan Zhulanow 11096325c8 [LL API] Fix 'this' capturing inside property accessors
^KTIJ-26726 Fixed
2023-09-12 08:47:28 +00:00
Anastasia.Nekrasova eab6e9bb36 Added tests for all code samples from KT-60523, except 2.3.
Test for 2.3 sample must be added in the context of KT-61792.
2023-09-12 07:03:20 +00:00
Roman Efremov 2dae7ce6c1 [LT2FIR] Fix missing "expect" modifier on members of nested classes
For members of nested classes inside expect class
`classWrapper.hasExpect()` would be false, because it only reflects
modifiers of nested class itself and not aware of "expect" modifier
inherited from the parent class.
Fix is done in same way in PSI2FIR, see
`PsiRawFirBuilder.Visitor.toFirProperty`.

This fix now makes it possible to add test for functionality from
previous commit.

Review: KT-MR-12107

^KT-61784
2023-09-11 21:29:02 +00:00
Roman Efremov c6d7f15070 [FE] Fix checker of DEFAULT_ARGUMENTS_IN_EXPECT_WITH_ACTUAL_TYPEALIAS
...not reporting on companion object members as well as other
nested classes.

Annotation classes are accepted because this is how it already worked,
see other tests, for example `annotationsViaActualTypeAlias.kt`.

Test for nested annotation classes will be added in subsequent commit,
because it currently will fail in test
`TreeCompareTest.testCompareDiagnostics` because light-tree2fir
produces different tree due to a bug when converting properties
from expect primary constructor. See subsequent commit for a fix.

Review: KT-MR-12107

^KT-61784
2023-09-11 21:29:02 +00:00
Vladimir Sukharev e0e2a57e3d [K/N] Add filecheck tests for atomic intrinsics
https://youtrack.jetbrains.com/issue/KT-60514/Add-llvm-filecheck-tests-for-atomic-intrinsics

Merge-request: KT-MR-12067
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-11 21:28:34 +00:00
Igor Chevdar 1ff7841ac7 [K/N][IR] Renamed PreInlineLowering to TypeOfLowering 2023-09-11 18:16:25 +00:00
Igor Chevdar 8f3b9694f7 [K/N] Extracted asserts removal to a separate lowering 2023-09-11 18:16:25 +00:00
Igor Chevdar e8ca45378b [K/N] Moved couple of phases down the pipeline 2023-09-11 16:31:22 +00:00
Dmitrii Gridin ecb808992d [SLC] add more tests on vararg
^KT-61422
2023-09-11 15:47:47 +00:00
Dmitrii Gridin 3a577e1c31 [Analysis API] add more tests for vararg parameters
^KT-61422
2023-09-11 15:47:47 +00:00
Dmitrii Gridin f1e5a9b223 [FIR builder] create error types for vararg parameters correctly
Otherwise, such types are treated as resolved, but anyway
requires transformation on type phase.
Also, this commit drops the redundant duplicated transformation of
typeReference from primary constructor property generator

^KT-61422
2023-09-11 15:47:47 +00:00
Dmitrii Gridin c0c1966555 [FIR builder] add test for vararg parameter without type
^KT-61422
2023-09-11 15:47:47 +00:00
Kirill Rakhman 2566dabfce [FIR] Report INVISIBLE_REFERENCE on the first unresolved qualifier
#KT-61719 Fixed
2023-09-11 14:23:55 +00:00
Nikita Bobko 2127b2ce68 expect/actual classes: experimental -> Beta
KT-61573
^KT-61712 Fixed
Review: https://jetbrains.team/p/kt/reviews/12044/files

It's a follow up commit

According our guidelines, it must be in Beta
https://kotlinlang.org/docs/components-stability.html#stability-of-subcomponents

And the whole multiplatform was in Beta, so we can't make part of the
multiplatform to have lower stability level
2023-09-11 13:57:28 +00:00
Svyatoslav Scherbina 0cd91d9286 Native: fix filecheck_signext_zeroext_objc_export and enable it back
Previously filecheck_signext_zeroext_objc_export test was disabled
after making one-stage compilation mode implemented through two-stage
mode (KT-59245).

That change made the compiler sort the methods, and filecheck patterns
didn't match that order after that.

This commit fixes the test by adding sorted prefixes to method names,
so sorting alphabetically them doesn't really change the order.
2023-09-11 13:49:36 +00:00
Svyatoslav Scherbina f77f83e741 Native: fix support for cross-target filecheck tests
There was a minor mistake in the build script configuration, leading to
a missing task dependency when running the tests with
`-Pkotlin.native.home=`.

More specifically, the build script was checking if the cross-dist for
the main tests target (`-PtestTarget=`) is in place, but instead it
should have checked if the cross-dist for the test cross-target
(`test.targetName`) is in place.

This commit fixes the check, and thus adds the missing task dependency.
2023-09-11 13:49:35 +00:00
Ivan Kylchik 5d88a1f1c3 [Native] Rename Lowerings to NativeLoweringPhases
This is done to unify the way how we name file
that contains lowerings in different backends.
2023-09-11 10:04:50 +00:00
Ivan Kylchik 386d69018d [JVM] Rename JvmLower to JvmLoweringPhases
This is done to unify the way how we name file
that contains lowerings in different backends.
2023-09-11 10:04:50 +00:00
Kirill Rakhman 16ae83bde0 [FIR] Fix Java sealed class inheritors
This fixes NO_ELSE_IN_WHEN diagnostics when using java sealed
classes in an exhaustive when.

#KT-58216 Fixed
2023-09-11 07:37:37 +00:00
Aleksei.Glushko 6405a174e2 [K/N] Do not CAS when marking newly allocated object
Merge-request: KT-MR-12038
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-09-09 12:42:54 +00:00
Alexander Shabalin 2f22b0a6b0 [K/N] Migrate runtime/atomics tests to new testing infra ^KT-61259 2023-09-09 07:25:35 +00:00
Abduqodiri Qurbonzoda ba374bb45c Optimize hex formatting and parsing implementation #KT-58218
Merge-request: KT-MR-11702
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-09-08 22:40:56 +00:00
Alexander Shabalin eb0a301a8f [K/N] Update CallsChecker list 2023-09-08 17:13:00 +00:00
Alexander Shabalin 6b6da5b08f [K/N] In executors make sure child process does not leak. 2023-09-08 16:22:52 +00:00
Mikhail Glukhikh 20cb075e56 K2: fix calculating property reference type in delegated setter
This commit is an accidentally forgotten part of the KT-61045 fix
#KT-61720 Fixed
2023-09-08 15:35:10 +00:00
Dmitry Savvinov 5736201e3a [K1, MPP] Implement hack for KTIJ-24195
Force-refine typealiases if their expansion isn't visible in the
refiner's module

^KTIJ-24195
2023-09-08 15:31:22 +00:00
Roman Golyshev 370a6fb461 KT-61728 [LL API] Add extra test for smartcast inside let 2023-09-08 14:41:39 +00:00
Roman Golyshev a20dea1b0a KT-61728 [LL API] Ignore CFG nodes with uninitialized flow
This is done until the KT-61794 is fixed
2023-09-08 14:41:39 +00:00
Roman Golyshev 23363ef1bd KT-61728 [LL API] Use ContextCollector in AllCandidatesResolver
Fix testdata for builder inference test in resolve tests - now it's the
same between K1 and K2
2023-09-08 14:41:39 +00:00
Alexander Shabalin ce371df5f6 [K/N] Set 2 minute timeout for StdlibTest 2023-09-08 14:01:43 +00:00
Alexander Shabalin ff88c76e3c [K/N] Parse duration for EXECUTION_TIMEOUT 2023-09-08 14:01:43 +00:00
Mikhail Glukhikh b0b6a6a05a K1/K2: deduplicate/simplify the code around JVM CLI
Related to KT-61510, KT-61745
2023-09-08 13:20:47 +00:00
Mikhail Glukhikh 3561054998 K1/K2: partially share code for multi-module chunks building
#KT-61510 Fixed
Related to KT-61716
2023-09-08 13:20:47 +00:00
Johan Bay a1c2ded8a3 [K/N] Header klibs: Keep private properties in value classes
^KT-61767 Fixed
2023-09-08 13:13:19 +00:00
Alexander.Likhachev 64fb36deef [Gradle] Move konan.data.dir for tests into <repo>/build and normalize the path
This should solve the problem on Windows CI with too long paths in Kotlin/Native integration tests
2023-09-08 13:04:29 +00:00
Alexander.Likhachev c33f7a4161 [Build] Disable ScriptingIT on Windows CI using @OsCondition
`@DisabledOnOs` doesn't propagate its effect to the inheritors
2023-09-08 13:04:29 +00:00
Vladimir Sukharev 3e2c662b6b [FIR] Add testcases to throw class with unresolved parent.
^KT-60048 Fixed
2023-09-08 11:40:35 +00:00
Vladimir Sukharev 69b2e2c0ba [FIR] Don't diagnose MISSING_EXCEPTION_IN_THROWS_ON_SUSPEND in presence of unresolved class
^KT-60048 Fixed
2023-09-08 11:40:35 +00:00
Marco Pennekamp 3fa2ca7ddd [AA] Add specific implementation for KtFirEnumEntryInitializerSymbol
- Previously, `KtFirAnonymousObjectSymbol` was a
  `KtEnumEntryInitializerSymbol`, which carried the risk that an
  anonymous object unrelated to enum entries might be used as an enum
  entry initializer. This commit introduces a specific symbol for FIR
  enum entry initializers.
- As a nice side effect, anonymous object symbol creation is simplified
  and `KtFirEnumEntryInitializerSymbolPointer` can restore the symbol
  via `KtFirEnumEntrySymbol.enumEntryInitializer`.

^KT-61425
2023-09-08 11:13:28 +00:00
Marco Pennekamp 536e172d0e [AA] Add declared member scope tests for enum entry initializers
^KT-61425
2023-09-08 11:13:28 +00:00
Marco Pennekamp 72de86a8ba [AA] Add tests for enum class member scopes
^KT-61405
2023-09-08 11:13:28 +00:00
Marco Pennekamp 3aefeb0fc5 [AA] Add tests for enum entry initializer member scopes
^KT-61425
2023-09-08 11:13:28 +00:00
Marco Pennekamp 3add7f9db5 [AA] Support enum entry initializers in member scope tests
- Now that the enum entry initializer provides a member scope, not the
  enum entry, we need a way to get to the enum entry initializer in
  tests. This can only be done via the enum entry's name, because the
  initializer is anonymous.

^KT-61425
2023-09-08 11:13:28 +00:00
Marco Pennekamp 80efa34926 [AA] Add KtEnumEntryInitializerSymbol
- An enum entry's body is an initializer with members only accessible
  within that body. Because users of the Analysis API might want to
  analyze the members of the enum entry initializer, we expose this
  initializer via `KtEnumEntrySymbol`. The initializer only exists if
  the enum entry has a body.
  - We already have some usages of the initializer inside symbol light
    classes, which generate a light class for each enum entry, which
    includes the enum entry's hidden members.
- To hide the implementation detail that initializers are anonymous
  objects, `KtEnumEntryInitializerSymbol` is simply a
  `KtSymbolWithMembers`.
- The advantage of making it a `KtSymbolWithMembers`, instead of
  providing a custom way to get a member scope, is that we can pass
  around the initializer easily, e.g. in `KtEnumEntrySymbolRenderer`.
- We implement `KtEnumEntryInitializerSymbol` directly as a
  `KtFirAnonymousObjectSymbol` without a wrapper. This has a few
  advantages:
  1. We can directly benefit from the anonymous object symbol being a
     `KtSymbolWithMembers`, so we don't have to handle enum entry
     initializers specially in e.g. `KtFirScopeProvider`.
  2. We don't have to implement a new symbol restoration mechanism for
     the initializer.
  3. This implementation matches the actual FIR tree structure (with a
     simplification that the connecting anonymous object expression
     between the enum entry and the initializing anonymous object is
     omitted).

^KT-61425 fixed
2023-09-08 11:13:28 +00:00
Marco Pennekamp e72a38dc82 [AA] Remove KtSymbolWithMembers from KtEnumEntrySymbol
- An enum entry is a variable which doesn't declare any additional
  members. It must not be confused with its implementing anonymous
  object initializer, which may declare additional members, but is an
  implementation detail hidden outside the enum entry's initializer.
  Hence, the enum entry variable should not have a (declared) member
  scope.
- A following commit will add the ability to get the enum entry's
  initializer, so that a member scope for this initializer can be
  obtained (which might be relevant for local analysis).

^KT-61405 fixed
2023-09-08 11:13:28 +00:00
Marco Pennekamp f64cc184f4 [FIR] Refactoring: Introduce base implementations for delegating scopes
- The implementations of some FIR scopes contain a significant amount of
  delegation to some original scope. This pollutes the implementation of
  such scopes and makes them harder to read.
  `FirDelegatingContainingNamesAwareScope` and `FirDelegatingTypeScope`
  can be used as base classes which delegate by default.
2023-09-08 11:13:28 +00:00
Nikita Bobko 3c73331821 KMP: Put "prohibit actual typealias to special annotations" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:43 +00:00
Nikita Bobko e742d43ee0 KMP: Put "prohibit expect/actual tailrec/external" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:43 +00:00