Commit Graph

99029 Commits

Author SHA1 Message Date
Pavel Punegov 45637c1b94 [K/N][build] Make build-tools to be able to build as a project
* Replace and fix project dependencies in build-tools
* Add Gradle annotations for tasks
2023-02-27 10:48:26 +00:00
Pavel Punegov dcc5c7e435 [K/N][build] Fix shared project to use projects directly 2023-02-27 10:48:25 +00:00
Pavel Punegov 931f7192a0 [K/N][build] Build scripts cleanup
* Removes unused dependencies
* Cleanup code
* Remove benchmark related sources
2023-02-27 10:48:25 +00:00
Pavel Punegov 71f2c3cf9b [K/N][perf] Move benchmarks related code to performance subdir 2023-02-27 10:48:25 +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
Nikita Bobko f620eb920f Drop redundant suppress
Review: https://jetbrains.team/p/kt/reviews/8933

The suppress was needed in https://jetbrains.team/p/kt/reviews/8308

But it's not needed anymore
2023-02-24 17:05:33 +00:00
Ilya Kirillov ce3305300b [FIR] temporary mute blackbox test which fails on runtime
It was failing before, but it was hidden as the actual test was not run due to the bug in the test pipeline.

In the case of any WrappedException.FromHandler were thrown, no blackbox tests were run.

Tracking issue: ^KT-56861
2023-02-24 16:11:45 +01: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 8ff330079e [Assign plugin] Remove experimentality warning
The plugin is still experimental, see
  https://kotlinlang.org/docs/components-stability.html

^KT-56925 Fixed
2023-02-24 11:19:45 +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
Yahor Berdnikau 473a2dc87c Fix KaptGenerateStubsTask freeCompilerArgs duplication
Now this task uses configured freeCompilerArgs both from itself and from
 linked KotlinCompile task. When these tasks are configured with the
 same value this leads to freeCompilerArgs duplication.

Added workaround is to use linked KotlinCompile freeCompilerArgs as
convention value for KaptGenerateStubsTask. Proper fix will be done via
KT-54468.

^KT-55452 Fixed
^KT-55565 Fixed
2023-02-24 09:20:23 +00:00
Yahor Berdnikau a49906f4e4 Bump AGP dependency version to 4.2.2
^KT-56454 Fixed
2023-02-24 09:17:47 +00:00
Yahor Berdnikau db5589121d Bump minimal supported AGP version to 4.2.2
^KT-56454 In Progress
2023-02-24 09:17:47 +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
Anton Lakotka fa4bbdf6d6 [Gradle] Avoid configuration resolution in MPP projects
Add `getResolvedArtifactsCompat` for compatibility with gradle <7.4
However configurations are still resolved in these gradle versions

^KT-51940 Verification Pending
2023-02-23 17:59:56 +00: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 0f384f5878 [K/N][IR] Workaround for off-scope type parameters
#KT-56500 Fixed
2023-02-23 15:32:25 +00:00
Igor Chevdar 5d3b61364a Added a test for KT-56500 2023-02-23 15:32:25 +00:00
Vladimir Sukharev 7c9e567496 [K2/N] KT-56028: Enable and patch test interop_kt49034_objcclass
Merge-request: KT-MR-8942
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-23 13:08:33 +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
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
Svyatoslav Scherbina 22ee170f44 [K2/N] Prohibit single-stage compilation with language version 2.0
Kotlin/Native compiler can compile source files directly to a native
binary (e.g. an executable or a framework). This is the so-called
"single-stage" compilation mode. It is used only in the command-line
compiler, while Kotlin Gradle plugin always produces an intermediate
klib first, and then compiles it to a native binary ("two-stage"
compilation mode).

When running Kotlin/Native compiler with '-language-version 2.0' in the
single-stage compilation mode, it in fact doesn't use the new K2
frontend. This is misleading and error-prone.

To address this problem, the commit prohibits the single-stage
compilation with '-language-version 2.0'. This affects only the
command-line compiler, and shouldn't affect compilation with Gradle.

^KT-56855
2023-02-23 11:36:38 +00:00
Aleksei.Cherepanov 25b6eb3114 [Maven] Add tests for K2
#KT-56903 Fixed

Co-authored-by: Ilya Gorbunov <Ilya.Gorbunov@jetbrains.com>

Merge-request: KT-MR-8922
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-02-23 11:24:20 +00:00
Pavel Kunyavskiy b306ed53aa [K/N] Support Enum entries in objc export
^KT-53653
2023-02-23 10:49:25 +00:00
Pavel Kunyavskiy b4bd847345 [K/N] Refactor ObjcExportTest build script 2023-02-23 10:49:25 +00:00
Ilya Gorbunov 69b90e107c Fix missing native-wasm source set in legacy docs build 2023-02-22 23:52:43 +00:00