Commit Graph

2789 Commits

Author SHA1 Message Date
Mads Ager 7dbb0c7d20 [IR] Make IrGetObjectValue copyable to avoid duplicate IR nodes.
Fixes KT-45170
2021-03-09 09:48:16 +03:00
Mads Ager 965c118521 [JVM IR] Make upper bounds check recursive for ieee Equals.
Fixes KT-44402
2021-03-05 12:22:54 -08:00
Dmitriy Novozhilov a6d1d47918 [FIR] Fix clearing info about DF variable after reassignment 2021-03-04 17:09:17 +03:00
Dmitriy Novozhilov 714c2a8f93 [FIR] Bind return expression to function symbol instead of function itself 2021-03-02 19:11:27 +03:00
Dmitriy Novozhilov 245bc7c8e2 [FIR2IR] Fix interpreting constants from const properties from other module 2021-03-02 19:11:26 +03:00
Mikhael Bogdanov 8764bb09f2 Generate synthetic annotation method in interface if -Xjvm-default is on 2021-03-01 16:20:19 +01:00
Alexander Udalov acc2256de9 IR: support smart cast values in RangeContainsLowering
#KT-44878 Fixed
2021-02-25 21:00:09 +01:00
Alexander Udalov b417786fd4 JVM IR: do not hide constructor with inline class in anonymous object
#KT-45131 Fixed
2021-02-25 14:44:16 +01:00
Victor Petukhov 27846f4532 Add tests for obsolete issues (KT-42722, KT-39880) 2021-02-25 15:30:29 +03:00
Dmitriy Novozhilov 4222bb9af2 [FE] Make whens on expect sealed classes and enums not exhaustive 2021-02-25 14:56:08 +03:00
Alexander Udalov addabae8d2 IR: move frontend-dependent code into implementations in psi2ir 2021-02-24 19:07:38 +01:00
Alexander Udalov d991a3e40f IR: simplify initialization cycle of TypeTranslator/ConstantValueGenerator 2021-02-24 19:07:38 +01:00
Alexander Udalov ca5a35b4b3 Move CompilerEnvironment from 'frontend' to 'cli'
This is needed in order to have a single convenient place where to
register frontend services implemented _outside_ of the 'frontend'
module, such as the control flow analysis, extracted to a separate
module in a subsequent commit.
2021-02-24 17:17:03 +01:00
Mads Ager 8852323a76 [PSI2IR] Do not generate property reference setter if inaccessible.
Fixes KT-45064.
2021-02-23 19:33:49 +01:00
Ilya Goncharov d9be59ea97 [JS IR] JS code in init block only for js ir backend test 2021-02-20 21:06:28 +03:00
Ilya Goncharov 187d4998fa [JS IR] Not cast to declaration parent in JsCodeOutlineLowering, use parent otherwise
^KT-45057 fixed
2021-02-20 13:08:45 +03:00
Denis.Zharkov 1fe0a1f160 FIR: Fix interface delegation case via type alias 2021-02-20 10:59:23 +03:00
Dmitry Petrov c629ba5a3c JVM_IR indy-SAM: function reference to Java interface 2021-02-19 12:04:30 +03:00
Ilmir Usmanov 741c1a864f JVM_IR: IC: Unbox inline class argument of callable reference
if it is unbound and the underlying type is reference type.
If the underlying type is primitive, it is boxed and unboxed
correctly, otherwise, it is simply casted and not unboxed.
Additionally, generate functions for inliner with inline classes
in signature, so unboxing works.
The unboxing is removed after inlining.
 #KT-44722 Fixed
2021-02-18 18:31:48 +01:00
Dmitry Petrov 744a0fcd25 PSI2IR KT-45022 object in LHS of compound assignment 2021-02-18 20:24:16 +03:00
Dmitry Petrov 6d019d9544 JVM_IR indy-SAM on functional expression 2021-02-17 22:18:06 +03:00
Anton Bannykh c06b345f3c Hide stageController into the IrFactory 2021-02-17 10:42:50 +03:00
pyos 1310a65f0c JVM: rename this$0 when regenerating nested objects too
In the old backend, this was unnecessary because nested objects would
reference their lambdas' captures through the original this$0. On
JVM_IR, using loose capture fields means a name/descriptor clash can
occur on any level of nesting, not just the top.
2021-02-17 07:56:03 +01:00
Dmitriy Novozhilov 83ed67546b [Test] Support WITH_STDLIB directive in js box tests 2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov dfcff132fd [FIR] Fix false-positive smartcast on receiver in rhs of elvis
#KT-44942 Fixed
2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov d4c26cca52 [FIR] Use type without smartcast for local variable with smartcasted initializer 2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov 40e286b354 [FIR] Increase level of sequential when branches
Level of CFGNode is used to determine which call is a common one for
  creating node with union of arguments (to merge flow from multiple
  in-place lambdas). Before this change calls in different when branches
  may have same node level, which entail passing smartcasts from moddle of
  one branch to another

```
val x: Any = ...
when {
    ... -> run { x as String } // (1)
    ... -> {
        run {
            x.foo()
        } // (2)
        "hello"
    }
}
```

Call `(1)` was assumed as argument of call `(2)` which is incorrect

#KT-44814 Fixed
2021-02-16 17:51:31 +03:00
Dmitry Petrov b1ab64e854 JVM_IR KT-44483 argument adaptation is already done in PSI2IR 2021-02-15 19:41:39 +03:00
Alexander Udalov 899f75466d Remove tests on kotlin-annotations-android
#KT-44815
2021-02-15 17:23:44 +01:00
Dmitriy Novozhilov 5711a8d610 [FIR] Support PreliminaryLoopVisitor in FIR DFA 2021-02-15 11:37:39 +03:00
Victor Petukhov 6f64fd2fec Propagate inference session into declaration analyzers
It prevents missing inference session for local declaration (local functions, local classes or objects)

^KT-44801 Fixed
2021-02-15 11:12:58 +03:00
Dmitry Petrov 3ebeca5852 JVM_IR: use indy SAM conversions in jvmTarget 1.8+, fix bridges
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:30 +03:00
Alexander Udalov 510b9e6f2a Move around some codegen box tests
In tests merged from boxAgainstJava in 29b96aa1, some directories were
named slightly differently compared to box, e.g. "property" vs
"properties", "varargs" vs "vararg". This change renames these, moves
some of the tests to more fitting directories, and also renames
"visibility" to "javaVisibility" because it's about Java visibilities
specifically.
2021-02-11 13:50:09 +01:00
Alexander Udalov 2d60fa787d Remove codegen tests on old language and API versions 2021-02-11 13:50:09 +01:00
Alexander Udalov 73aa465ee9 Add tests for issues fixed in JVM IR
Note that KT-30696 is fixed only in the single-module case, and KT-42012
is not fixed fully (see KT-44855).

 #KT-30041
 #KT-30629
 #KT-30696
 #KT-30933
 #KT-32351
 #KT-32749
 #KT-38849
 #KT-42012
 #KT-42990
 #KT-44234
 #KT-44529
 #KT-44631
 #KT-44647
2021-02-10 21:42:10 +01:00
Igor Chevdar 6f9bcf249b [IR] Supported inlining of adapted references + tests 2021-02-09 17:23:19 +05:00
Ilmir Usmanov 275fef94fe JVM_IR. Do not mangle callable reference constructor call
#KT-44703 Fixed
2021-02-09 12:31:11 +01:00
Roman Artemev ca6e1b8f1b Add box test for #KT-43831 2021-02-09 11:33:34 +03:00
pyos d96921e287 FIR2IR: collect annotations when expanding type aliases 2021-02-08 18:23:19 +03:00
Ilya Goncharov 19bffc694b [JS IR] Add test with chain export--not-export--export
^KT-44616 fixed
2021-02-08 13:41:16 +03:00
Ilya Goncharov 6c051b2be4 [JS IR] Override method are not exported
[JS IR] Add test with jsexport overrides not js export method with stable name

^KT-44616 fixed
2021-02-08 13:38:30 +03:00
pyos 64c5608f31 FIR: expect nullable type for elvis LHS 2021-02-08 13:00:22 +03:00
Ilmir Usmanov cd189c0812 JVM_IR. Do not unbox Result in inline lambda
Since JVM_IR generates inline lambdas differently from old backend,
in this case, it generates them as normal functions.
Thus, there is no need to unbox the lambda argument.
 #KT-44671 Fixed
2021-02-04 20:22:20 +01:00
Svyatoslav Kuzmich ae738e9c59 [JS] Add basic optional logs to test runner 2021-02-04 16:16:21 +03:00
Dmitriy Novozhilov 29b96aa15d [Test] Properly merge box against java testdata into codegen/box
Previous commit about it was 3199ce03 and it was completely wrong
2021-02-04 10:53:50 +03:00
Ilmir Usmanov 02f845636e JVM_IR: Box generic Result parameter in suspend lambda
#KT-44527 Fixed
2021-02-03 19:18:27 +01:00
Dmitry Petrov ab20a8ffff JVM_IR indy-lambdas: minor updates and fixes
KT-44278 KT-26060 KT-42621
2021-02-03 14:16:25 +03:00
Dmitry Petrov d94912ed62 JVM_IR indy-lambdas: initial implementation and tests
KT-44278 KT-26060 KT-42621
2021-02-03 14:16:22 +03:00
Ilya Goncharov de3678a805 [JS IR] Add test with fun interface call inside lambda
^KT-44433 fixed
2021-02-03 12:13:53 +03:00
pyos 8277c96933 FIR: copy nullability when mapping type alias arguments 2021-02-03 08:38:56 +03:00