Commit Graph

7127 Commits

Author SHA1 Message Date
Ivan Kylchik 30c00f7983 [IR] Specify explicitly that classes from Java can be interpreted
In early prototypes of interpreter, it was easier to assume that
all classes from Java can be interpreted and fix something if not.
Check for Java declaration was done by checking that the package name is
starting with "java". But this is actually wrong and can lead to errors
when some code is declared in "java" something package, but is not from
Java stdlib.

#KT-60467 Fixed
2023-07-20 09:40:42 +00:00
Ivan Kylchik ecd20b1348 [JVM_IR] Properly handle inlined local var located in regenerated object
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik 17e49fce75 [JVM_IR] Support basic fake var generation for IR inliner
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik 2ecbb21a9f [IR] Add new tests on inline to check issues with type parameters
#KT-58241
2023-07-20 09:01:42 +00:00
Artem Kobzar 044c0adae7 [K/JS] Implement an incremental compilation for the per-file granularity 2023-07-19 15:57:56 +00:00
Artem Kobzar e4bdd3560c [K/JS] Change order of exported properties definition for non ES-classes compilation ^KT-60131 Fixed 2023-07-19 14:33:19 +00:00
Artem Kobzar b1884456b8 [K/JS] Fix initialization issue for objects which annotated with @JsExport and contain nested classes
Merge-request: KT-MR-11146
Merged-by: Artem Kobzar <Artem.Kobzar@jetbrains.com>
2023-07-19 10:41:25 +00:00
Artem Kobzar 69c8942462 [K/JS] Remove trivial JS constructors from JS AST 2023-07-19 10:41:04 +00:00
Vladimir Sukharev f7269eb384 [FIR2IR] Rework reordering condition to better handle synthetic class delegation fields
^KT-60243

Merge-request: KT-MR-11125
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-07-19 09:59:53 +00:00
Artem Kobzar 41f27d19b5 [K/JS, K/Wasm] Generate star imports for external objects with the @JsModule annotation for ES modules 2023-07-18 15:36:19 +00:00
Alexander Udalov 69059362b8 Fir2Ir: generate 'finally' block always with Unit type
This is important for IR lowerings like PolymorphicSignatureLowering
which are very sensitive about the correct types of expressions and
placement of coercions to Unit (KT-59218).

A boolean parameter to `insertImplicitCasts` is not the best solution to
ensure that coercion to Unit is added. The best solution would be to fix
the TODO and generate coercion to the block's type for the last
statement. But that will affect many other places and will need to be
done separately => KT-59781.

Code in IrInterpreter is uncommented to fix the FIR test
`compiler/testData/ir/interpreter/exceptions/tryFinally.kt`; otherwise
evaluation of the function `returnTryFinally` there crashes with
"NoSuchElementException: ArrayDeque is empty". No idea why this test
didn't fail for K1 though, since the created IR is exactly the same.

For some unknown reason this breaks WASM backend with K2, but not with
K1 => KT-59800.
2023-07-18 11:37:41 +00:00
Alexander Udalov 5513740659 Minor, remove extraneous box tests
These tests are already present in
`compiler/testData/codegen/box/classes/kt496.kt`.
2023-07-18 11:37:41 +00:00
Vladimir Sukharev f9df4e1487 [K/N] Reorder hashCode, toString, equals in data classes to match K1 order
^KT-60247 Fixed

Merge-request: KT-MR-11080
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-07-18 00:06:48 +00:00
Dmitriy Dolovov ce815968cf [Native][tests] Use convention fun generatedTestDir() in build.gradle.kts 2023-07-17 21:09:40 +00:00
Dmitriy Dolovov 938146749d [PL][tests] K/JS: Avoid any unexpected warnings to appear in tests 2023-07-17 21:09:40 +00:00
Dmitriy Dolovov 715aba3d18 [PL][tests] K/JS: Run compiler through CLI interface 2023-07-17 21:09:40 +00:00
Kirill Rakhman feed740415 [FIR2IR] Don't copy default value to annotation call with vararg parameter
This aligns the behavior with K1 and fixes an issue when the default
value was deserialized as FirExpressionStub leading to an exception
in FIR2IR when trying to convert it to an IR expression.

#KT-60120 Fixed
#KT-59610 Fixed
2023-07-17 11:42:39 +00:00
Alexander Korepanov a588e75c11 [JS IR] Optimize JS AST for closures
^KT-58891 Fixed
2023-07-13 16:37:18 +00:00
Alexander Korepanov 524c475834 [JS IR] Implement MoveTemporaryVariableDeclarationToAssignment optimization 2023-07-13 16:37:18 +00:00
Alexander Korepanov 25f7b81d51 [JS IR] Drop TemporaryAssignmentElimination optimization
Enable TemporaryAssignment tests
2023-07-13 16:37:17 +00:00
Yahor Berdnikau 73f6316f27 [repo] Enable warnings as errors for Gradle Kotlin scripts 2023-07-12 12:49:32 +00:00
Brian Norman 10ed26991d [FIR] Extract LHS receiver of assignment operator statements
#KT-53490 Fixed
2023-07-12 11:41:33 +00:00
Artem Kobzar fdda394a77 [K/JS] Calculate generated function names based on signatures of argument types (instead of fqNames) ^KT-49077 Fixed 2023-07-11 13:14:45 +00:00
Mikhail Glukhikh 39406710b2 FIR2IR: fix origin calculation for explicit inc/dec calls 2023-07-11 08:28:04 +00:00
Igor Yakovlev 750653e4b3 [Wasm] Add kotlin wasm wasi mode compiler flag 2023-07-07 15:23:18 +00:00
Dmitriy Novozhilov e7a10057f2 [Test] Use special test facade for IR actualization and IR plugins in all codegen configurations
Previously application of plugins was part of fir2ir conversion and
  ir actualization was the responsibility of each specific IR backend
  facade. Now (after moving IR extensions after IR actualization) those
  actions are extracted into separate facade for two purposes:
1. Avoid code duplication in backend facades
2. Step with this facade goes exactly after fir2ir conversion before
   irHandlersStep, which allows IR handlers to observe IR which was
   actualized and modified by extensions, which is quite useful

^KT-56173
2023-07-07 11:26:15 +00:00
Dmitriy Novozhilov 8e73d5a54a [FIR] Run irGenerationExtensions after IR actualization
^KT-56173 Fixed
2023-07-07 11:26:15 +00:00
Artem Kobzar cf949e8760 [K/JS] Support KClass<*>.createInstance reflection method ^KT-58684 Fixed 2023-07-06 18:18:14 +00:00
Alexander Korepanov 2cb28b6be1 [JS IR] Add an explicit toString() call for concatenating Char values
^KT-59718 Fixed
2023-07-06 14:40:06 +00:00
Dmitriy Dolovov 8aacdb471b [K/N] Fix: Ignore bridge functions in FunctionReferenceLowering
^KT-59858
2023-07-06 12:39:46 +00:00
Ivan Kylchik d3d28783c5 [IR] Support const optimizations for JS backend 2023-07-06 11:00:14 +00:00
Ilya Goncharov b6803b2400 [JS] Migrate web demo examples 2023-07-06 08:08:55 +00:00
Ilya Goncharov b5a7b9c661 [JS] Migrate multi module order test 2023-07-06 08:08:55 +00:00
Ilya Goncharov 08c04af5b5 [JS] Remove legacy line numbers test 2023-07-06 08:08:55 +00:00
Kirill Rakhman b68962018c [FIR] Remove incompatible from expect actual matching if compatible exists
This fixes an issue with checking for default values in call resolution
(see FirDefaultParametersResolver) where it is expected that the map
only contains a single compatible entry.

#KT-59613 Fixed
2023-07-05 08:51:01 +00:00
Alexander Korepanov 4695dca056 [JS IR] Keep box and unbox intrinsics in call args after decomposing
^KT-59717 Fixed
2023-07-05 07:33:03 +00:00
Artem Kobzar 9ad5910de9 [K/JS] Remove isObject check from runtime ^KT-57926 Fixed 2023-07-03 13:19:43 +00:00
Denis.Zharkov 3279313f2c K2: Fix priority for implicit receiver + extensionInvoke
See K1 counterpart at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.Task.processImplicitReceiver

^KT-58943 Fixed
^KT-59541 Fixed
2023-07-01 16:29:06 +00:00
Artem Kobzar 966a342bf1 [K/JS] Migrate invalidation tests to ES modules 2023-06-30 16:13:35 +00:00
Alexander Udalov 5dc882abf5 Reflection: create synthetic classes instead of throwing UOE
... for Kotlin-generated classes which do not correspond to a "class"
from the Kotlin language's point of view. For example, Kotlin lambdas,
file facade classes, multifile class facade/part classes, WhenMappings,
DefaultImpls. They can be distinguished from normal classes by the value
of `KotlinClassHeader.Kind` (which is the same as `Metadata.kind`).

Another theoretical option would be to throw exception at the point
where the `::class` expression is used, if the expression's type on the
left-hand side is a synthetic class. But we can't really do that since
it'll affect performance of most `<expression>::class` expressions.

So, construct a fake synthetic class instead, without any members except
equals/hashCode/toString, and without any non-trivial modifiers. It kind
of contradicts the general idea that kotlin-reflect presents anything
exactly the same as the compiler sees it, but arguably it's worth it to
avoid unexpected exceptions like in KT-41373.

In the newly added test, Java lambda check is muted but it should work
exactly the same as for Kotlin lambdas and other synthetic classes. It's
fixed in a subsequent commit.

 #KT-41373 In Progress
2023-06-30 13:11:41 +00:00
Alexander Udalov 1e031d9fb8 Reflection: add test on introspection of local classes
kotlin-reflect works correctly already for Kotlin-generated local
classes and anonymous objects, but not for Java ones. This is fixed in a
subsequent commit.

 #KT-41373 In Progress
2023-06-30 13:11:41 +00:00
Ilya Goncharov 0ac0c51c23 [JS] Remove Ant js test 2023-06-29 14:25:45 +00:00
Ilya Goncharov b0b266b73d [JS] Fix test of Ir Stdlib api 2023-06-29 14:25:45 +00:00
Dmitriy Dolovov f2f935846c [JS] Fix IC tests to reflect changes in signature rendering
^KT-59486
2023-06-26 15:59:31 +00:00
Alexander.Likhachev cb087b7def [Build] Bump gradle-node-plugin version to 5.0.0
This change is required to fix a configuration cache problem revealed after migration to Gradle 8.1
2023-06-26 10:36:25 +00:00
Vladimir Sukharev 09a0905ffc [Test] Convert IGNORE: NATIVE directives in rest of tests
^KT-59057 Fixed

Merge-request: KT-MR-10794
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-26 07:44:12 +00:00
Svyatoslav Kuzmich 4ad6fd4cde [Wasm] Add RUN_UNIT_TESTS directive to unit-test compiler tests 2023-06-25 10:20:43 +02:00
Svyatoslav Kuzmich a3e2d2804c [Wasm] Update testData after adding K2 and new test infra support.
- Actualize muted K2 tests
- Actualize muted K1 tests with module systems because legacy Wasm test
  infra had no respect for "// MODULE: ..." test directives
2023-06-25 10:20:40 +02:00
Svyatoslav Kuzmich 736519c506 [JS] Rename JsLibraryProvider to LibraryProvider
This class is not JS-specific and can be used in Wasm test services
2023-06-25 10:18:50 +02:00
Vladimir Sukharev 7930885131 [Test] Convert IGNORE: NATIVE directives in box tests from M to R
^KT-59057

Merge-request: KT-MR-10757
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-23 14:15:48 +00:00