Commit Graph

16782 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 0bbc61f459 [FIR] Unwrap flexible types in when exhaustiveness checker
^KT-56942 Fixed
2023-02-24 14:58:18 +00:00
Svyatoslav Kuzmich 4be2f53b47 [Wasm] Add @JsFun diagnostics (KT-56944)
JsFun target should be top-level external function
2023-02-24 11:35:16 +00:00
Svyatoslav Kuzmich 1da96213ca [Wasm] Add @WasmImport diagnostics (KT-56943)
WasmImport annotated functions:
* Restricted to top-level external functions
* Only supports primitive numbers, booleans and Unit
  (as return type only) in its signature
* Can't have default parameter values
* Can't have vararg parameters
2023-02-24 11:35:16 +00:00
Svyatoslav Kuzmich f79607d32d [Wasm] Add @JsExport diagnostics test
@JsExport is only allowed on top-level functions in K/Wasm

Restrictions for nested function are handled by reusing K/JS diagnostics
Restrictions for classes and properties are handled by specifying
 annotation target in stdlib
2023-02-24 11:35:16 +00:00
Svyatoslav Kuzmich b4fcfd6719 [Wasm] Add external declaration diagnostics (KT-56940)
Prohibit:
- external enum class
- external tailrec fun
- external suspend fun
- external lateinit var

Add tests for other external diagnostics inherited from K/JS
2023-02-24 11:35:15 +00:00
Svyatoslav Kuzmich 83ba1ac0f7 [Wasm] Diagnostic test: dynamic type is unsupported
Validates the fix for KT-56711
2023-02-24 11:35:15 +00:00
Svyatoslav Kuzmich c9e71985da [Wasm] Stop dumping declarations in diagnostic tests
These tests are meant to check diagnostics, but
having to update .txt dumps adds some friction to development process.
2023-02-24 11:35:14 +00:00
Svyatoslav Kuzmich 321a476898 [Wasm] Add external inheritance checker.
Prohibit non-external types to extend external types.
This type of inheritance is not supported in Wasm backend.
2023-02-24 01:05:23 +01:00
Ilmir Usmanov b3890885c4 JVM: Break infinite loop in finding meaningful instruction
during tail-call optimization.

There can be code, where all next instructions are non-meaningful and
there is a back-edge, for example, while(true){}. Previously, analyzer
incorrectly assumed, that this cannot happen. Now, it keeps track of
visited instructions and says, that there is no meaningful instruction
in such case.
 #KT-56815 Fixed
2023-02-23 17:54:46 +00: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
Igor Chevdar 5d3b61364a Added a test for KT-56500 2023-02-23 15:32:25 +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
Alexander Udalov d73d3c46e2 K2 JVM IR: fix access to Java field shadowed by Kotlin property
#KT-56386 Fixed

Co-authored-by: Mikhail Glukhikh <Mikhail.Glukhikh@jetbrains.com>
2023-02-23 12:54:00 +01:00
Alexander Udalov 641d636c45 JVM IR: improve generation of receiver for bound callable references
Trick codegen into generating getfield from the anonymous class instead
of its supertype (e.g. kotlin.jvm.internal.FunctionReference,
PropertyReference or AdaptedFunctionReference). This gets rid of
unnecessary accessors in some cases, and will help in the subsequent
commit that changes logic around access to fields from Java
superclasses.
2023-02-23 12:54:00 +01:00
Alexander Udalov 4ad594a3cd Minor, move tests about Java field and Kotlin property
Because the `fieldRename` directory was originally about cases when
private fields are renamed because of clashes.
2023-02-23 12:54:00 +01:00
Pavel Mikhailovskii 7700484a16 [AA] Fix conversion of annotation values 2023-02-22 13:55:50 +00:00
Ilmir Usmanov 6be734c27e JVM: Remove inplace arguments before state-machine building
#KT-56258 Fixed
2023-02-22 12:45:03 +00:00
Dmitrii Gridin 41278d0797 [SLC] drop redundant AnnotatedPropertyWithSites.fir.java
^KT-56842
2023-02-22 12:39:31 +01: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
Pavel Mikhailovskii 81746e5aa1 KT-56508 Add a test 2023-02-21 16:22:26 +00:00
Ilmir Usmanov bfa2937fb8 FIR2IR: Do not add fake override if the member is overridden
#KT-56398 Fixed
2023-02-21 17:18:01 +01: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
Denis.Zharkov 0c9fad87c3 K2: Fix deserialization of upper bound of type parameter in nested class
Previously, containingDeclarationSymbol for V was set to the outer class
BaseRoot, so its upper bounds was computed to the ones from TNested
at org.jetbrains.kotlin.fir.resolve.calls.CreateFreshTypeVariableSubstitutorStageKt.getTypeParameterFromExpandedClass

^KT-56706 Fixed
2023-02-21 12:35:34 +00:00
Svyatoslav Scherbina f206ff950c [K2/N] Ignore kt15016.kt test because it fails due to KT-56747 2023-02-21 11:52:06 +00:00
Pavel Mikhailovskii 752ba433cc KT-53846 LT: Copy context receivers to secondary constructors 2023-02-20 18:13:54 +00:00
Ivan Kylchik 477d092bb8 Avoid object's interpretation with nullable type
#KT-56215 Fixed
2023-02-20 15:52:52 +00:00
Denis.Zharkov 99448b77f3 FIR2IR: Imitate K1 behavior when SAM type has a bit different shape
See the relevant test at t/
estData/codegen/box/sam/contravariantIntersectionType.kt

After the previous commit, when generating a call for `doOnSuccess {}`,
we have a SAM type with removed projection Consumer<Any?>, while
real function type of the lambda is a bit different
(Function1<ConcreteType & ConcreteType2>).

While for me, that looks questionable, but in K1 it was effectively
resolved via the same implicit cast that on JVM is generated to an
INVOKEDYNAMIC that wraps initial function-typed value.

^KT-53552 Fixed
2023-02-20 14:54:09 +00:00
Denis.Zharkov 05ca001310 FIR2IR: Repeat the K1 behavior: SAM conversion with 'in' projection
It would be more consistently to prohibit the behavior from the unmuted
test (see KT-52428), but it was decided to postpone the breaking change.

Unfortunately, it didn't work to make a test where for computing
star projections we would need to substitute other type parameters
because effectively, it's not allowed to have SAM conversion when
star projections/wildcard is based on a type parameter which bounds
use other type parameters.

^KT-53552 In progress
2023-02-20 14:54:09 +00:00
Dmitriy Novozhilov ae7863518d [Test] Mute tests due to KT-56508 2023-02-20 08:40:33 +00:00
Dmitriy Novozhilov 0d100cf114 [Test] Mute tests due to KT-53846 2023-02-20 08:40:33 +00:00
Dmitriy Novozhilov 49f15a16ce [Test] Mute tests due to KT-56760 2023-02-20 08:40:32 +00:00
Dmitriy Novozhilov 7c84f9a7c2 [Test] Mute test due to KT-56759 2023-02-20 08:40:32 +00:00
Dmitriy Novozhilov 28b83a1a5d [Test] Mute tests due to KT-56755 2023-02-20 08:40:32 +00:00
Dmitriy Novozhilov 86ee855170 [Test] Mute test due to KT-56756 2023-02-20 08:40:31 +00:00
Dmitriy Novozhilov 94faa759cb [CLI] Rename -XdependsOn flag to -Xdepends-on to keep convention
^KT-56209
2023-02-17 14:09:30 +00:00
Dmitrii Gridin e65c863f8c [SLC] add test on single target annotation
^KT-56728
2023-02-17 13:11:14 +00:00
Dmitriy Novozhilov 86af01439c [FIR] Allow to access uninitialized member properties in non-inPlace lambdas in class initialization
^KT-56696 Fixed
^KT-56408
2023-02-17 11:26:18 +00:00
Dmitriy Novozhilov c87e489dc9 [FIR] Run CFA for member properties even if they have initializer
^KT-56678 Fixed
^KT-56682 Fixed
2023-02-17 11:26:17 +00:00
Dmitriy Novozhilov de84cb8038 [Test] Don't compare descriptors dump if there is no expected .txt file
Descriptors dump has not much sense, because at this point diagnostic
  tests for FE 1.0 mostly used only to compare diagnostics with FIR
2023-02-17 11:26:16 +00:00
Dmitriy Novozhilov 79e4df72bf [CLI] Introduce utilities for creating FirSession hierarchy in CLI for all platforms
Also support session creation and compilation for HMPP projects

^KT-56209 Fixed
2023-02-17 11:08:51 +00:00
Dmitriy Novozhilov 30ea4b6b53 [FIR2IR] Adapt IrActualizer to HMPP modules
Previously it collected actual declaration only from platform module
2023-02-17 11:08:51 +00:00
Dmitriy Novozhilov 77caa31640 [CLI] Add CLI arguments to pass HMPP module structure to the compiler
^KT-56209
2023-02-17 11:08:50 +00:00
Nikolay Lunyak 516efe77c9 [FIR] KT-56612: Fully-expand types when casting bare types
^KT-56612 Fixed

Merge-request: KT-MR-8849
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-02-17 09:15:59 +00:00