Sergej Jaskiewicz
55ae6d1f3e
[JS IR] Optimize pattern-matching of enums into comparing their ordinals
...
For this code:
```
enum class Season {
WINTER,
SPRING,
SUMMER,
AUTUMN
}
fun bar1(x : Season) : String {
return when (x) {
Season.WINTER, Season.SPRING -> "winter_spring"
Season.SUMMER -> "summer"
else -> "autumn"
}
}
```
previously we generated this:
```
function foo(x) {
var tmp0_subject = x;
return (tmp0_subject.equals(Season_WINTER_getInstance())
? true
: tmp0_subject.equals(Season_SPRING_getInstance()))
? 'winter_spring'
: tmp0_subject.equals(Season_SUMMER_getInstance())
? 'summer'
: 'autumn';
}
```
And now we generated this:
```
function bar2(x) {
var tmp0_subject = x;
var tmp0 = tmp0_subject._get_ordinal__0_k$();
var tmp;
switch (tmp0) {
case 0:
case 1:
tmp = 'winter_spring';
break;
case 2:
tmp = 'summer';
break;
case 3:
tmp = 'autumn';
break;
default:
noWhenBranchMatchedException();
break;
}
return tmp;
}
```
2021-10-14 11:44:01 +00:00
Svyatoslav Kuzmich
279f184703
[JS] Remove failed checks based on unstable naming
2021-10-12 23:29:39 +03:00
Sergej Jaskiewicz
65d40c2253
[JS IR] Make tests that use directives pass with IR BE
2021-10-06 09:23:50 +00:00
Mikhail Glukhikh
d8f9643650
[FIR2IR] Use intersection type approximation for receivers
2020-05-07 15:27:17 +03:00
Mikhail Glukhikh
a4c7619c89
[FIR2IR] Introduce & use FirBuiltInsPackageFragment
...
Without this commit, JVM name mapping logic in BE does not work for FIR,
because FIR cannot use old BuiltInsPackageFragmentImpl descriptor.
In this commit we add our own implementation thus fixing
a pack of FIR black box tests.
2020-03-24 10:37:53 +03:00
Mikhail Glukhikh
94fe79578e
[FIR2IR] Generate unconditional branch in exhaustive whens
2020-03-20 11:55:34 +03:00
Mikhail Glukhikh
39bd97147f
[FIR] Don't create initializers for simple enum entries
...
Usually FIR enum entry is initialized by anonymous object,
which is the container for all enum entry' declarations.
However, for simple enum entries there is no need of initializer at all.
2020-02-21 16:38:52 +03:00
Alexander Udalov
8f30b25b24
Minor, fix some codegen tests for language version 1.4
...
These tests check behavior of an old language version on purpose: the
original bug KT-24708 has been fixed by introducing an error here in
1.4.
2019-12-30 16:30:45 +01:00
Mark Punzalan
9df2f69f09
[FIR] Disable failing blackbox codegen tests for FIR.
2019-11-19 11:00:09 +03:00
Alexander Udalov
95be7171bc
JVM IR: fix "null" as the first entry in MappedEnumWhenLowering
...
If "null" was the first entry in an optimizable "when" over enum,
mapRuntimeEnumEntry was called before mapConstEnumEntry, and the
$WhenMappings field was not created. Now both mapConstEnumEntry and
mapRuntimeEnumEntry create this field on the first access
2019-10-23 11:03:22 +02:00
Mikhael Bogdanov
1b2145af22
Fix test data
2018-10-25 09:12:26 +02:00
Mikhael Bogdanov
e5ef5d096e
Fix test data
2018-10-25 09:10:40 +02:00
Svyatoslav Kuzmich
7074909230
[JS IR BE] Support enumValues<T>() and enumValueOf<T>(name)
2018-10-10 19:35:17 +03:00
Denis Zharkov
c1cc722ac4
Turn off incorrect switch-optimization for when by enums
...
#KT-24708 Fixed
2018-09-12 09:49:25 +03:00
Roman Artemev
6c8e30eb05
Fix test failures
...
* add metadata
* unmute working tests
* mute temporary broken ones
2018-08-09 20:55:50 +03:00
Mikhael Bogdanov
357359b1dd
Unmute ir-tests after CR support
2018-08-09 14:22:50 +03:00
Svyatoslav Kuzmich
625983b28a
[JS IR BE] Enum class lowering
2018-07-23 15:08:18 +03:00
Mikhael Bogdanov
e149cbe852
Mute failed jvm ir tests
2018-06-28 12:26:41 +02:00
Anton Bannykh
96355e2732
JS IR: mute codegen box tests automatically
2018-06-09 19:15:38 +03:00
Alexey Andreev
89db4dfe79
JS: translate when against enum to JsSwitch when possible
2017-11-17 11:07:41 +03:00
Igor Chevdar
d7e4350d42
Ignored/fixed some tests for Kotlin/Native
2017-06-28 12:54:32 +03:00
Mikhael Bogdanov
df8394bcd2
Fix for KT-14597: "When" over smartcasted enum is broken and breaks all other "when"
...
#KT-14597 Fixed
2017-01-24 15:17:47 +01:00
Alexey Andreev
b5358122e2
JS: unmute shared box tests
2016-11-16 19:50:10 +03:00
Zalim Bashorov
596f3364c6
Automatically mute failed tests
2016-11-09 21:41:12 +03:00
Alexander Udalov
06a67e6602
Merge boxWithStdlib testData into box, delete BoxWithStdlib test
2016-03-09 10:25:38 +03:00
Alexander Udalov
20e36438e2
Move some tests from boxWithStdlib/ to box/
...
Move those tests which do not require neither stdlib nor reflect
2016-03-09 10:25:38 +03:00