Commit Graph

2317 Commits

Author SHA1 Message Date
Ivan Kochurkin d87619e06e [FIR & IR] Support of default values for arguments in expect functions
Add FirActualDeclarationChecker that checks expect/actual return types

^KT-56331 Fixed, ^KT-56334 Fixed
2023-03-01 22:10:07 +00:00
Andrei Klunnyi 66a74ab60e KT-56941 Gradle KTS navigation: go to declaration (Java) doesn't work
Case:
```
options.incrementalAfterFailure = false    // assignment operator  (a)
options.incrementalAfterFailure.set(false) // equivalent (without) (b)

// (a) works thanks to AssignResolutionAltererExtension
// 'incrementalAfterFailure' is a synthetic Java property
// i.e. getIncrementalAfterFailure()

// Navigation to 'incrementalAfterFailure' (a) doesn't work.
```

By navigation, we mean opening declaration sources. The reason of the
issue lied in sources absence (inability to find them).

In general, sources are available via declaration descriptor.
To find one for a property, one needs to understand expression
kind: read/write/both. Hence, the choice of a getter/setter/both.
Since `=` operator is interpreted as a write type expression, a setter
was searched. Missing one resulted in corrupted navigation.

As a fix we provide getter for the missing setter case.

^KT-56941 fixed
2023-03-01 13:25:38 +00:00
Dmitrii Gridin 0a1c903e11 [SLC] add tests for containingClass
^KT-56613
2023-03-01 10:43:03 +00:00
Dmitrii Gridin 9129235079 [LC] add missing parent to implementsList and extendsList
^KT-56613
2023-03-01 10:43:03 +00:00
Dmitrii Gridin 58dc93da90 [LC] do not store name identifier as property
^KT-56613
2023-03-01 10:43:02 +00:00
Dmitrii Gridin 327208fb8a [SLC] drop hard references to member declarations to reduce memory consumption
^KT-56613 Fixed
2023-03-01 10:43:02 +00:00
Dmitrii Gridin 7af78db2e1 [DLC] drop hard references to member declarations to reduce memory consumption
^KT-56613
2023-03-01 10:43:02 +00:00
Dmitrii Gridin e20f72fcf8 [SLC] introduce tests on equality
^KT-56613
2023-03-01 10:43:01 +00:00
Dmitrii Gridin 847b29ac15 [DLC] add missing identity checks to 'equals'
^KT-56613
2023-03-01 10:43:01 +00:00
Dmitrii Gridin 95455c9870 [DLC] add missing visitor methods
Some of our light classes have no correct parent (KT-56882),
so I temporarily disabled
AbstractSymbolLightClassesParentingTestBase for such cases
(previously decompiled light classes were not tested at all)

^KT-56613
^KT-56882
2023-03-01 10:43:01 +00:00
Dmitrii Gridin 0bd193ccba [SLC] rename AbstractSymbolLightClassesEqualityTest to AbstractSymbolLightClassesEquivalentTest
^KT-56613
2023-03-01 10:43:00 +00:00
Dmitrii Gridin 8c757e36ea [SLC] provide correct parent for annotations on type
The first step of KT-56870

^KT-56613
^KT-56870
2023-03-01 10:43:00 +00:00
Dmitrii Gridin 7273610d41 [SLC] introduce AbstractSymbolLightClassesParentingTestByPsi
^KT-56613
2023-03-01 10:43:00 +00:00
Dmitrii Gridin cfb358140c [SLC] rename AbstractSymbolLightClassesParentingTest to AbstractSymbolLightClassesParentingTestByFqName
^KT-56613
2023-03-01 10:42:59 +00:00
Dmitrii Gridin 68e6dba22b [SLC] extract base class from AbstractSymbolLightClassesParentingTest
^KT-56613
2023-03-01 10:42:59 +00:00
Dmitrii Gridin bf600afce0 [SLC] extract base class from AbstractSymbolLightClassesStructureTest
^KT-56613
2023-03-01 10:42:59 +00:00
Dmitrii Gridin 5e18ebcd7e [DLC] cleanup code and drop some redundant constructions
^KT-56613
2023-03-01 10:42:58 +00:00
Dmitrii Gridin 007af1c547 [DLC] use library tracker instead of out of block tracker
^KT-56613
2023-03-01 10:42:58 +00:00
Dmitrii Gridin b565df65c4 [SLC] drop redundant properties to reduce memory consumption
^KT-56613
2023-03-01 10:42:58 +00:00
Ilya Kirillov 4944b454c5 [Analysis API] optimize KotlinPackageProvider.getSubPackageFqNames
Previously, we queried heavy kotlin package provider two times which affected performance
Now it's being queries only a single time

Also, the commit introduces separation for KotlinPackageProvider between kotlin and platform-specific packages

^KTIJ-24640
2023-02-28 13:38:23 +00:00
Kirill Rakhman fbc0796ed2 [FIR] Accept opt-in annotations on primary ctor params of properties
For backward compatibility with K1.

KT-56177
2023-02-28 10:19:20 +00:00
Kirill Rakhman 2139914061 [FIR] Add diagnostic when annotation argument is resolved ambiguously
Annotation arguments that are resolved in COMPILER_REQUIRED_ANNOTATIONS
phase are resolved again in ANNOTATION_ARGUMENTS phase. If they resolve
to a different symbol, report an error.

KT-56177
2023-02-28 10:19:19 +00:00
Kirill Rakhman eee66ab43f [FIR] Remove duplicate annotations from primary ctor params/properties
If an annotation doesn't specify an explicit use-site target,
previously it was added to both, the primary constructor value parameter
and the property in the FIR. Then, in FIR2IR, only the "correct" one was
added to the IR. Move up the deduplication logic into the frontend.

^KT-56177 Fixed
2023-02-28 10:19:17 +00:00
Dmitriy Novozhilov 8ff4af034a [FIR] Don't drop directly inherited functions from origins for intersection overrides in intersection scope
```
open class Base<T> {
    fun foo(): T = ...
}

class Derived<T> : Base<T> {
    override fun foo(): T = ...
}
```

In intersection scope of type `Base<T> & Other<R>` we should create
  intersection override based on `Base.foo(): T` and `Derived.foo(): R`
  at the same time, despite the fact that `Derived.foo` actually directly
  overrides `Base.foo`

^KT-56722 Fixed
2023-02-28 09:17:41 +00:00
Dmitriy Novozhilov 244dbb37cf [FIR] Properly set isOperator flag for java functions
^KT-56875 Fixed
2023-02-28 09:17:40 +00:00
Dmitriy Novozhilov df47581c5a [FIR] Consider call site in argument mapping handling for set operator call
^KT-56542 Fixed
^KT-56714 Fixed
2023-02-28 09:17:40 +00:00
Dmitriy Novozhilov cbc8b74e89 [FE 1.0] Don't check star projections in PrivateInlineFunctionsReturningAnonymousObjectsChecker
^KT-56692 Fixed
2023-02-28 09:17:39 +00:00
Dmitriy Novozhilov 2a022ca9e0 [FIR] Properly propagate deadness from try main block throw finally block
^KT-56476 Fixed
2023-02-28 09:17:39 +00:00
Nikolay Lunyak be5850112a [FIR] KT-56723: Ensure safe access over non-expressions is always Unit
^KT-56723 Fixed
2023-02-27 15:00:30 +00:00
Ilya Kirillov 0089517b25 [Analysis API FIR] optimize KtFirCompletionCandidateChecker.checkExtensionFitsCandidate
We do not need running IMPLICIT_TYPES_BODY_RESOLVE to check candidate applicability.

Additional resolve to IMPLICIT_TYPES_BODY_RESOLVE takes about 5% of completion time

^KTIJ-24640
2023-02-27 09:40:41 +00:00
Egor Kulikov 163017fcaf [FIR] Do not dereference delegate in lazy mode
Tenth step for ^KT-52615
2023-02-24 19:42:11 +00:00
Jiaxiang Chen 7ce2f64c18 AA: apply java type enhancement to declaredMemberScope.
* added getDeclaredMemberScope to JavaScopeProvider.
2023-02-24 19:57:10 +01:00
Ilya Kirillov 69c024a5ce [FIR] optimize deprecation calculation for symbols
All symbols except member callables can be deprecated if they have non-empty annotation list

^KT-56800 fixed
2023-02-24 16:10:57 +01:00
Dmitriy Novozhilov 0bbc61f459 [FIR] Unwrap flexible types in when exhaustiveness checker
^KT-56942 Fixed
2023-02-24 14:58:18 +00:00
Dmitriy Novozhilov da581f38e1 [Test] Require specifying parser for FIR test. Unify names for FIR tests
Now all tests with `Fir` in name are named accordingly to parser which
  is used in them -- `FirPsi` or `FirLightTree`. This is needed to keep
  consistency between different types of tests, because there is no
  single default in parser mode between different scenarios of using FIR
2023-02-24 11:15:26 +00:00
Dmitrii Gridin 7e36a88b82 [LL FIR] FirDesignation: add workaround for LLFirLibraryOrLibrarySourceResolvableModuleSession
^KTIJ-24326
2023-02-24 11:09:43 +00:00
Svyatoslav Kuzmich 54a45c49f8 [Wasm] Add Wasm platform and K1 FE infrastructure 2023-02-24 01:05:23 +01:00
Dmitrii Gridin 550b4f1f11 [SLC] throw exception on redundant test data file 2023-02-23 17:15:53 +00:00
Pavel Mikhailovskii 9204f8162e [SLC] Fix modifiers for @JvmStatic methods in interfaces 2023-02-23 17:04:22 +00:00
Pavel Mikhailovskii 378bb4c4ac KT-56891 SLC Don't include abstract members in DefaultImpls 2023-02-23 12:50:59 +00:00
Dmitriy Novozhilov 331cc1465a [FE] Properly parse java class name from sources if java class has annotations
^KT-56847 Fixed
2023-02-23 12:14:15 +00:00
Jinseong Jeon 5455942859 AA: handle underscore as type arguments
^KTIJ-24742 Fixed
2023-02-23 13:02:34 +01:00
Pavel Mikhailovskii 7700484a16 [AA] Fix conversion of annotation values 2023-02-22 13:55:50 +00:00
Pavel Mikhailovskii 492a161d2c KT-56842 [SLC] Don't mark primitive context receiver parameters with @NotNull 2023-02-22 10:15:19 +00:00
Pavel Mikhailovskii de1927abb6 KT-56835 [SLC] Mark property$delegate fields as final and @NotNull 2023-02-22 09:40:32 +00:00
Denis.Zharkov 3f052af517 K2: Propagate explicit getter type to the property without initializer
In K1, we have the rules like:
- if there's explicit type of a property, then use it
- if there's an initializer, obtain its expression-type
- Otherwise, use getter's return type

The case when getter's type is implicit is handled at
FirDeclarationsResolveTransformer.transformProperty

^KT-56707 Fixed
2023-02-21 18:39:40 +00:00
Pavel Mikhailovskii d81170fbcc KT-56840 [SLC] Don't mark primitive-backed types with @NotNull 2023-02-21 17:29:16 +00:00
Nikita Bobko 9a865e4c55 [FE 1.0] Issue a warning if expect and actual are declared in the same module
The commit is based on b09561c3c3
Co-authored-by: Dmitriy Novozhilov <dmitriy.novozhilov@jetbrains.com>

^KT-40904 Fixed
^KT-55177 Fixed
Review: https://jetbrains.team/p/kt/reviews/8731

True negative test already exist:
`compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/intermediateWithActualAndExpect.kt`
2023-02-21 14:45:46 +01:00
Nikita Bobko 456605542c Make it possible to run hmpp tests with ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE
In scope of KT-40904 KT-55177
Review: https://jetbrains.team/p/kt/reviews/8731

In order to make it possible to run hmpp tests with
`ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE`, a dependency manager
must be implemented. This commit implements some basic dependency
manager. I'm not sure in its correctness because
`CommonDependenciesContainer` is an awkward API, but this dependency
manager works for my cases.

Why: I need hmpp + `ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE`
infrastructure to cover `ExpectActualInTheSameModuleChecker` (I will add
the checker in the next commit) with tests. The checker couldn't be
covered with regular hmpp tests because regular hmpp tests and
`K2MetadataCompiler` run the compiler in a different way.
Contrary, `ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE` runs the compiler in a
way `K2MetadataCompiler` does it.

I moved some tests from hmpp to `hmpp/multiplatformCompositeAnalysis`
because otherwise the tests would fail after I implement
`ExpectActualInTheSameModuleChecker` in the next commit.

Also the descriptor dumps were changed
(intermediateWithActualAndExpect.txt and
sealedInheritorsInComplexModuleStructure.txt). It happened because now
common source sets are no longer "squashed" into a single source set but
rather correct dependencies between source sets are established. And
each source set is analyzed separately (exactly like in
K2MetadataCompiler)
2023-02-21 14:45:45 +01:00
Denis.Zharkov 14ca12b50b K2: Add test for obsolete KT-56663
It was fixed via 898a9a0f2c together with
KT-53966

^KT-56663 Obsolete
2023-02-21 12:36:04 +00:00