Commit Graph

42683 Commits

Author SHA1 Message Date
Egor Kulikov 163017fcaf [FIR] Do not dereference delegate in lazy mode
Tenth step for ^KT-52615
2023-02-24 19:42:11 +00:00
Ilya Kirillov dec9bdefb6 [FIR] continue executing the test pipeline in a case of FirLazyResolveContractViolationException is thrown
Previously in the black-box test, no actual tests were run in a case FirLazyResolveContractViolationException were thrown
2023-02-24 16:10:58 +01:00
Ilya Kirillov d2f3dce8c9 [FIR] do not resolve to status inside FirNamedFunctionSymbol.isLocal
1. this optimizes the isLocal call
2. this allows to check isLocal without resolving the status from the `FirNamedFunctionSymbol.canBeDeprecated`
2023-02-24 16:10:58 +01:00
Ilya Kirillov c366a7a9b0 [FIR] optimize FirSymbol.resolvedContextReceivers 2023-02-24 16:10:58 +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
Ilmir Usmanov 01c670194a FIR2IR: Do not add fake override if the member is overridden
#KT-56398
2023-02-24 14:24:12 +00:00
Alexander Udalov 5f4a560899 Fix binary compatibility with AS 222/223 in PhaseConfig
(cherry picked from commit a419120cbd6050417945a0e9f411213debd15b77)
2023-02-24 14:23:52 +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
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
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
Svyatoslav Kuzmich 54a45c49f8 [Wasm] Add Wasm platform and K1 FE infrastructure 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
Simon Ogorodnik 253cdb1b8f KT-56789: Fix memory leak in CoreJrtFileSystem
CoreJrtFileSystem uses JrtFileSystemProvider provider to read contents
of jrt-fs from JDK
Implementation of FileSystems.newFileSystem causes metaspace memory leak
that wasn't fixed until JDK 17, see
https://bugs.openjdk.java.net/browse/JDK-8260621

When FileSystems.newFileSystem used to create jrt-fs on JDK9 with
provided java.home value it creates new ClassLoader under-the-hood,
which subsequently leaks due to aforementioned bug

Remove conditional usage of `java.home` + FileSystems.newFileSystem and
switch to use jrt-fs classloader cache regardless of
compiler runtime JDK to reduce classloader leaks

^KT-56789
2023-02-23 15:55:24 +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
Dmitriy Dolovov 4b1f739c89 [PL] Don't use trove4j in partial linkage 2023-02-23 11:40:19 +00:00
Alexander Udalov 1cb77a47ec Fir2Ir: extract error about unsupported mutation 2023-02-22 22:40:34 +00:00
Alexander Udalov 22b4b29292 IR: make most properties mutable 2023-02-22 22:40:34 +00:00
Alexander Udalov d2938e732a IR: remove IrTypeOperatorCall.typeOperandClassifier 2023-02-22 22:40:34 +00:00
Alexander Udalov 42daeaaa80 IR: remove IrCallableReference.referencedName
It was added in 66da676b9e to avoid dependency on descriptors, but now
it doesn't use descriptors anyway, so it's better to inline it than have
it in the interface.
2023-02-22 22:40:33 +00:00
Alexander Udalov d286409b76 IR: make IrComposite.isTransparentScope an extension 2023-02-22 22:40:33 +00:00
Pavel Mikhailovskii 7700484a16 [AA] Fix conversion of annotation values 2023-02-22 13:55:50 +00:00
Yahor Berdnikau 96316a4016 Generate KotlinNativeCompilerOptions Gradle DSL
^KT-53108 In Progress
2023-02-22 13:02:59 +00:00
Ilmir Usmanov 68841fa031 Minor. Regenerate tests 2023-02-22 12:45:03 +00:00
Ilmir Usmanov 6be734c27e JVM: Remove inplace arguments before state-machine building
#KT-56258 Fixed
2023-02-22 12:45:03 +00:00
Vladimir Dolzhenko 3e99807436 Add ability to provide specific AbsentDescriptorHandler
#EA-457188

Merge-request: KT-MR-8900
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-02-22 12:44:46 +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 66eb29962a K2: Add minor clarification comment to FirDeclarationsResolveTransformer 2023-02-21 18:39:40 +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
Denis.Zharkov c09607c791 K2: Minor. Reformat and clean up a couple of transformers
`@Suppress("UNCHECKED_CAST")` became redundant there
2023-02-21 18:39:40 +00:00
Denis.Zharkov bdb1e28912 K2: Minor. Simplify condition at FirDeclarationsResolveTransformer
Just to avoid double negation at !hasNonDefaultAccessors
2023-02-21 18:39:39 +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
Alexander Korepanov 3c9d653595 [JS IR] Ignore unbound symbols in IC infrastructure
The IR linker is responsible for detecting unbound symbols,
 if it skips them for some reason, IC infrastructure must not fail
 with unbound symbols exceptions. Anyway, the IR validator
 verifies later if there are unbound symbols in
 reachable IR and generates the corresponding error.

^KT-56602 Fixed
2023-02-21 14:46:44 +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