Commit Graph

134 Commits

Author SHA1 Message Date
Alexander Korepanov 78aa34b3e8 [JS IR] Fix JS box tests
^KT-62425
2023-10-26 19:22:14 +00:00
Artem Kobzar 05ed134fbb [K/Wasm] Introduce stepping tests for Wasm 2023-08-15 17:03:11 +00:00
Alexander Korepanov 2fdb605a03 [JS IR] Fix tests
^KT-59001
2023-07-21 14:48:29 +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
Alexander Korepanov 524c475834 [JS IR] Implement MoveTemporaryVariableDeclarationToAssignment optimization 2023-07-13 16:37:18 +00:00
Ivan Kylchik 8f88f08573 [FIR] Use correct source for implicit this receiver
#KT-57489 Fixed
#KT-56139 Fixed
#KT-56755 Fixed
2023-06-23 07:23:39 +00:00
Artem Kobzar 039b5fca7a [K/JS] Use declared upper-bound types for parameters inside inlined functions body, instead of the provided types 2023-06-20 12:01:28 +00:00
Evgeniy.Zhelenskiy 2d920df507 [IR] Fix KT-59346, KT-55993
#KT-59346
#KT-55993
2023-06-19 12:36:08 +00:00
Ilmir Usmanov a41d36edba JS IR: Minor. Disable test 2023-05-31 11:21:39 +00:00
Ilmir Usmanov aec78ab2d8 Minor. Add regression test for KT-42696
#KT-42696 Fixed
2023-05-11 11:15:06 +02:00
Alexander Udalov 987e8c25dc K2: do not generate line numbers for delegated members
Psi2ir does not generate them, see
https://github.com/JetBrains/kotlin/blob/1.8.20/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt#L319.

Besides influencing debugger and coverage behavior, it also affects how
conflicting JVM signature diagnostics are reported because they
use offsets to determine which element to report the error on. So after
this change, K1 and K2 behavior is the same in that regard as well.

 #KT-58215 Fixed
2023-05-10 10:32:07 +00:00
Alexander Udalov 45bf70c9f9 Minor, add debug stepping test for KT-44745 2023-05-09 12:44:47 +00:00
Alexander Korepanov 79d378f2bd [JS IR] Perform optimizations on the generated JS code
The patch adopts and reuses the optimizations from the legacy backend.

The optimizations remove useless temporary variables,
statements and simplify generated JS code.

The optimizations can be disabled by `-Xoptimize-generated-js=false`.

Related to KT-51139
2023-04-18 12:49:33 +00:00
Ilya Chernikov aa3c189d83 FIR: fix return statement generation for Unit-returning lambdas...
for case then the expected return type is not Unit.
#KT-56747 fixed
2023-03-22 13:23:24 +00:00
Ivan Kylchik eb86aabb50 [FIR LT] Unmute some stepping and local variable tests
Corresponding tests were fixed together with #KT-56982, #KT-56913,
#KT-56926
2023-03-21 16:33:00 +00:00
Ivan Kylchik 2b387e7a10 [FIR LT] Get correct startOffset value for declarations with comments
#KT-56913 Fixed
#KT-56926 Fixed
2023-03-21 16:33:00 +00:00
Ivan Kylchik e4591d7af9 [FIR LT] Add proper source for when with subject
#KT-56982 Fixed
2023-03-21 16:33:00 +00:00
Ivan Kylchik 7cf70e7b15 [JVM IR] Fix performance issue caused by support of IR Inliner 2023-03-20 23:36:33 +00:00
Ivan Kylchik b812a6c6f5 Ignore tests that are currently not working with IR inliner 2023-03-14 20:47:42 +00:00
Ivan Kylchik 1e2ae137bf Slightly change JS test data results in three files
This change is caused by previous commit and was extracted
as a separate change not to mix JVM and JS changes
2023-03-14 20:47:40 +00:00
vladislav.grechko 17e6099b53 Initialize 'source' property of FirCatch objects properly
^KT-56923: Fixed
^KT-56755: Fixed
2023-03-08 12:03:35 +00:00
Nikolay Lunyak bcfafc601e Add EnumEntries to minimal-stdlib-for-tests
This change allows to revert adding `WITH_STDLIB` directive
to tests which happened at `a9343aeb`.

Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-03-02 10:23:38 +00:00
Dmitriy Novozhilov 28b83a1a5d [Test] Mute tests due to KT-56755 2023-02-20 08:40:32 +00:00
Nikolay Lunyak a9343aeb7d [FIR] KT-55840: Ensure everything actually works
This inconsistency is present due to not using the `// WITH_STDLIB`
in the above tests. When K1 creates the enum, it tries to generate
`entries()`, and for that it tries to load `kotlin.enums.EnumEntries`,
but this is actually an unresolved reference. K1 silently swallows it,
and proceeds.

The reason K2 doesn't fail is that in order to generate `entries()` it
simply creates the necessary `ConeClassLikeType` with the desired
`classId` instead of loading the whole `ClassDescriptor`.

The reason we can still observe `$ENTRIES` and `$entries` in K1
is because they are generated during the JVM codegen, and it
only checks if the `EnumEntries` language feature is supported. It
doesn't check if the `entries` property has really existed in IR
(by this time it's expected to have already been lowered to the
`get-entries` function - that's why "has ... existed").

The reason why the codegen doesn't fail when working with
`kotlin.enums.EnumEntries` is because it creates its
own `IrClassSymbol`.

^KT-55840 Fixed

Merge-request: KT-MR-8727
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-02-10 16:57:51 +00:00
Artem Kobzar 71486a321c [K/JS] Add support of compilation with ES-classes 2023-01-17 18:14:17 +00:00
Artem Kobzar 67048151fb [K/JS] Change js-call inlining strategy and + ability to referencethis safely from the js call ^Fixed KT-54134 2022-11-30 11:43:22 +00:00
Sergej Jaskiewicz becbc06663 [JS] Re-enable some stepping tests 2022-11-18 10:37:58 +00:00
Ilya Chernikov 5b3816cce5 Test infra: refactor IGNORE_BACKEND directive
treat it as a general one, introduce *_K1 and *_K2 variants for
more specific ignoring
2022-11-12 16:28:23 +01:00
Sergej Jaskiewicz 7b7c517dbb [JS IR] Emit original names for local vars to sourcemaps
#KT-35655 Fixed
2022-11-09 12:35:44 +00:00
Sergej Jaskiewicz ba7f5afebe [JS IR] Generate debug info for catch parameters
We will need it to generate original names for catch parameters in
sourcemaps.

Also, don't generate redundant debug info for compiler-generated
exception handling control flow operators.

See the doc comment to the MultipleCatchesLowering class

#KT-46276
2022-11-02 13:14:01 +00:00
Sergej Jaskiewicz 4ae03ea74a [JS IR] Improve debug info for if and when statements
#KT-46276
2022-11-02 13:14:01 +00:00
Sergej Jaskiewicz ccbb2a08a0 [JS IR] Improve debug info for functions with default parameters
Don't generate unnecessary mappings so that the user doesn't need to
step in many times to get where they want

#KT-46276
2022-11-02 13:14:00 +00:00
Sergej Jaskiewicz 512a2bfd7a [JS IR] Improve debug info for callable references and lambdas
#KT-46276
2022-11-02 13:13:59 +00:00
Sergej Jaskiewicz fe0e9db3aa [JS IR] Generate debug info for JS switch statements
#KT-46276
2022-11-02 13:13:59 +00:00
Sergej Jaskiewicz b2b7958b62 [JS IR] Generate debug info for secondary constructors
#KT-46276
2022-11-02 13:13:58 +00:00
Sergej Jaskiewicz ec18dce7cb [JS IR] Improve debug info for suspend functions
- Map generated explicit Unit returns to the closing brace of
  the original body
- Name the continuation parameter as `$completion` to match the JVM BE,
  and generate debug info for it (so that it appears in the 'names'
  array in sourcemaps)
- Don't generate debug info for coroutine instantiation ceremony
  (so that the user doesn't need to step in many times to get where they
  want)

#KT-46276
2022-11-02 13:13:58 +00:00
Sergej Jaskiewicz 0e3f48314a [JS IR] Improve stepping test executor
Don't search for box function in the generated code;
instead, stop the execution right before calling it.

This makes stepping tests more accurate.
2022-10-27 09:28:05 +00:00
Sergej Jaskiewicz a939f9ccd0 [JS IR] Improve debug info precision for blocks
Namely:
- Generate debug info for closing braces, which allows the breakpoints
  set on closing braces to be hit
- Generate debug info for 'if' and 'try/catch' statements.

KT-46276
2022-10-18 14:31:14 +00:00
Sergej Jaskiewicz d9681caf0c [JS IR] Generate 'names' entries for functions in sourcemaps 2022-10-14 10:09:40 +00:00
Sergej Jaskiewicz c9c50ff73c [JS IR] Disable some flaky stepping tests
^KT-54283
2022-10-04 10:31:14 +00:00
Artem Kobzar 73e7053c35 [K/JS] Use only single variant of default arguments function wrapper for exported and not-exported functions 2022-09-19 17:49:04 +00:00
Sergej Jaskiewicz 17f22c7204 [JS IR] Use a special executor for stepping tests
This will hopefully fix flakiness for some tests
2022-08-30 13:38:47 +00:00
Sergej Jaskiewicz d57ddc5f83 [JS IR] Generate debug info for JS injections
Also, fix the JS parser to collect the "correct" debug info
(see the note in `translateJsCodeIntoStatementList`)

#KT-53361 Fixed
2022-08-22 23:15:52 +00:00
Sergej Jaskiewicz 2ece4f4dbf [JS IR] Improve the precision of execution of stepping tests 2022-08-05 11:53:40 +00:00
Steven Schäfer 7e472301b6 Re-enable "JVM IR: Move direct invoke optimization into a separate pass" 2022-07-29 01:06:44 +02:00
Sergej Jaskiewicz 1241565cce [JS IR] Adapt stepping tests for Kotlin/JS 2022-07-19 16:06:24 +00:00
Sergej Jaskiewicz ea556ce428 [JS IR] Implement stepping tests for Kotlin/JS
We already have stepping tests for Kotlin/JVM.
They are helpful for testing the correctness of the generated
debugging information.

They are better than line number tests in that they allow to test the
_behavior_, not the generated data. The structure of the data may change
even if the behavior stays the same. For that reason, stepping tests
are more stable.
2022-07-19 16:06:23 +00:00
Alexander Udalov b50d2ff20a Revert "JVM IR: Move direct invoke optimization into a separate pass"
This reverts commit f0760e0550.

The reason is that it leads to KT-53202.
2022-07-15 18:29:07 +02:00
Steven Schäfer f0760e0550 JVM IR: Move direct invoke optimization into a separate pass
This also changes the transformation to inline the body of a directly
invoked lambda rather than producing a call to an anonymous local
function. The latter is unsupported in inline functions and problematic
from an ABI perspective, since it results in functions whose name
depends on the entire source code up to this point.
2022-07-14 23:24:18 +02:00