Commit Graph

637 Commits

Author SHA1 Message Date
Mads Ager 41aa0a7c7f [FIR] Fix line number differences between psi2ir and fir2ir. 2021-11-01 15:43:13 +03:00
Artem Kobzar 790e8843f9 fix(JS_IR): add outer classes resolving inside the function inliner. 2021-10-28 17:34:58 +00:00
Ivan Kylchik f4bbcdc013 [TESTS] Move global directives outside file scope 2021-10-25 00:14:19 +03:00
Svyatoslav Kuzmich 279f184703 [JS] Remove failed checks based on unstable naming 2021-10-12 23:29:39 +03:00
Svyatoslav Kuzmich 15acc412ba [Wasm] Update testdata after coroutines support 2021-10-12 08:42:00 +03:00
Sergej Jaskiewicz 65d40c2253 [JS IR] Make tests that use directives pass with IR BE 2021-10-06 09:23:50 +00:00
Svyatoslav Kuzmich c88cde2f8b [Wasm] DONT_TARGET_WASM_BACKEND => IGNORE_BACKEND in testdata 2021-10-02 06:14:35 +00:00
Tianyu Geng fadde98a86 FIR: fix label stealling and crash with multiple labels
Consider the code below

```
fun test() {
  a@ b@ {
    {}
  }
}
```

Currently when the code is converted to FIR, label `b` is bound to the
outer lambda and `a` gets bound to the inner lambda because it's not
consumed. This is wrong and also leads transfromation to fail with
exceptions because of the unexpected consumption of `a`.

This change fixes the above issue by designating a specific node in the
AST as the allowed user of a label when the label is added.
2021-10-01 17:21:40 +03:00
Victor Petukhov 5326c875c0 Update compiler tests after rebase 2021-09-30 20:09:00 +03:00
Victor Petukhov 01e853fb9b Introduce error for SUPER_CALL_FROM_PUBLIC_INLINE
^KT-45378 Fixed
2021-09-30 20:08:36 +03:00
Roman Artemev f644f47360 [IR] Add test for KT-47767 2021-09-30 14:39:01 +03:00
Pavel Kunyavskiy fb875c484d [K/N] Implement instantiating of annotation class 2021-09-23 06:59:34 +00:00
Leonid Startsev f033d3d5b7 Remove ignored dexing in tests after it was fixed
by rewriting IR codegen (https://github.com/JetBrains/kotlin/pull/3986/files#diff-9fe05d2f7c421d566cd1294a191d5a2e8f6e6f7a5f6b638542b79369caf91d4eR454)
2021-09-22 11:41:13 +00:00
Georgy Bronnikov 64e2911b58 JVM_IR: special case for raw types in DescriptorMangleComputer 2021-09-21 21:16:02 +03:00
pyos f786084a0a JVM_IR: mark direct uses of inline lambdas as conditionally suspend
They may or may not be inlined later.

IDK how the test passes when both modules are compiled with the old
backend - perhaps this has something to do with the fact that when `f`
is compiled with the IR backend, the call to `x()` is followed by `pop`
and `getstatic kotlin/Unit.INSTANCE`? This is probably why the original
issue in kotlinx.coroutines reports that everything works fine with
kotlinx-coroutines-core:1.4.3.

^KT-46879 Fixed
^KT-48801 Fixed
2021-09-20 19:29:44 +02:00
Igor Yakovlev 41a69ad388 [WASM] Add receiver capturing to callable references 2021-09-20 19:08:22 +03:00
Igor Chevdar e194a07358 [tests] Added some tests 2021-09-16 10:54:14 +00:00
Mikhail Glukhikh fc6403679a Rename !USE_EXPERIMENTAL test directive to !OPT_IN 2021-09-10 16:29:16 +03:00
pyos 7ce5556de3 JVM_IR: try to fix SyntheticAccessorLowering.isAccessible again
The condition on the relationship between the current class and the type
of the receiver for protected members was the opposite of what the JVMS
says, and yet somehow mostly worked?

 #KT-48331 Fixed
 #KT-20542 Fixed
2021-09-03 15:54:16 +03:00
Leonid Startsev 1932546a90 Support instantiation of annotations in JS
#KT-47700 Fixed
2021-09-01 11:13:55 +00:00
pyos a15a5aa429 JVM_IR: generate instance fields even when reification is needed
The inliner supports that, we just need to generate the reification
markers on GETFIELD to instance fields.
2021-08-23 14:27:51 +02:00
pyos d3de0109ca Add tests for KT-48180 2021-08-18 18:39:33 +02:00
Mikhael Bogdanov a5e59e09ee Copy methods for lambdas to DefaultImpls without receiver transformation
#KT-48230 Fixed
2021-08-18 09:58:27 +00:00
pyos 6d7eb2bd21 Add test for KT-48230 2021-08-18 09:58:27 +00:00
Dmitry Petrov 15c41b2610 JVM_IR KT-47984 add test for argument reordering 2021-08-13 18:08:52 +03:00
Georgy Bronnikov 1d913a6bf0 JVM_IR: add test for serialization of raw types 2021-08-10 00:37:46 +03:00
Georgy Bronnikov 3b8cb4b00d ModuleTransformerForTwoFilesBoxTests -> SplittingModuleTransformerForBoxTests
Need to include Java files in IR serialization tests, so generalize
TwoFilesBoxTest for more than two files.
2021-08-10 00:37:44 +03:00
Georgy Bronnikov fb801bdc33 IR: fix mangling of toplevel properties 2021-08-10 00:37:36 +03:00
Georgy Bronnikov 54957ead5c JVM_IR: add test for signatures of flexible types 2021-08-10 00:37:27 +03:00
Andrey Zinovyev 06b23d5937 [FIR] Improve the control flow graph around try expressions
1. throw goes to catches instead of main exist block
2. return goes via finally (single level only supported atm)
3. collect non-direct return to retrieve all return expressions easier
2021-08-06 11:49:34 +03:00
Dmitriy Novozhilov b9c549803d [Test] Replace public fun box() with fun box() in all box tests 2021-08-01 22:23:40 +03:00
Leonid Startsev 83c1a75c1e Revert "Revert "Instantiation of annotations for JVM IR with the corresponding feature flag""
Fix incorrectly rebased ce0a3a57df

This reverts commit 3d0126d5
2021-07-21 18:24:07 +03:00
Leonid Startsev 3d0126d5dd Revert "Instantiation of annotations for JVM IR with the corresponding feature flag"
because of incorrect rebase

This reverts commit ce0a3a57
2021-07-21 15:23:24 +03:00
Leonid Startsev ce0a3a57df Instantiation of annotations for JVM IR with the corresponding feature flag
Seperate checker for platforms that do not support this language feature yet

Synthetic implementations of annotations are generated on-demand with proper 
equals, hashCode, and annotationType methods

#KT-47699 Fixed
2021-07-21 10:23:51 +00:00
Georgy Bronnikov 28bff2ba4f JVM_IR: add test for calling monitorEnter/Exit from serialized code. 2021-07-14 21:20:38 +03:00
Georgy Bronnikov fa4efd3303 JVM_IR: fix deserialization of Java static field symbols 2021-07-14 21:20:35 +03:00
Georgy Bronnikov 7bbc04b6a2 JVM_IR: reconstruct fake overrides after IR deserialization.
We need to keep track of local signatures for deserialized symbols.
2021-07-14 21:20:29 +03:00
Georgy Bronnikov 96ce124268 JVM_IR: serialize fake overrides in IR 2021-07-14 21:20:21 +03:00
pyos 07cb3a5ff8 JVM: do not reify methods of objects in lambdas
All type parameters used in them are not from the inline function
anyway.
2021-07-14 10:11:05 +02:00
pyos 100d2d629c JVM: inline default lambda coercions from bridge invoke
The type of the default lambda may be a subtype of the parameter type,
so we can't really generate our own coercions at all as we don't know
the precise Kotlin type of the `invoke` method.
2021-07-14 10:11:05 +02:00
pyos 50797dba8d JVM: do not use crossinline flag when inlining assertions
Crossinline lambdas *can* be inlined into objects, but don't *have* to;
the correct place should be determined from the context, not from the
parameter.
2021-07-07 16:48:01 +02:00
pyos e64cda61d5 JVM_IR: do not generate $assertionsDisabled twice during inlining 2021-07-07 16:48:01 +02:00
Igor Chevdar caa852061a [box-tests] Ignored a test for K/N
More info in https://youtrack.jetbrains.com/issue/KT-44571
2021-06-16 17:25:07 +05:00
pyos 392e4fba42 JVM: fix inlining of default lambdas of signature (Result) -> Any
They have no `invoke` bridge, and the overridden invoke expectes a boxed
`Result` as an argument.
2021-06-16 12:13:32 +02:00
pyos 3be348f910 JVM_IR: fix parentClassId for property accessors 2021-06-11 15:03:13 +02:00
pyos ade8b0a7d3 JVM_IR: box bound receiver before calling the reference constructor
This is needed for the inliner: since the information about Kotlin type
of the bound receiver is nowhere in the output binary, the inliner will
have no clue how to box inline class values. Moving the boxing outside
the object means the inliner doesn't need to know about it; from its
point of view, the captured value has type `Any`.
2021-06-09 14:36:07 +03:00
pyos 33ddeffcfd JVM_IR: box inline class values returned by suspend inline lambdas
The call site inside the inline function expects them to return a boxed
value, like FunctionN.invoke would.

 #KT-46915 Fixed
2021-05-26 08:33:55 +02:00
Dmitriy Novozhilov df60e7368a [Test] Fix syntax errors in few boxInline tests 2021-05-19 00:52:24 +03:00
Dmitry Petrov 851980e36f JVM_IR KT-45103 optimize direct invoke for lambdas and callable refs 2021-05-18 22:20:12 +03:00
pyos 21f2b3fa2b JVM: expect a continuation parameter in default suspend references 2021-05-18 10:48:31 +02:00