Commit Graph

8267 Commits

Author SHA1 Message Date
Mikhail Glukhikh ad3502a952 Don't refer self function in Fir2IrLazySimpleFunction.initialSignature
This commit prevents stack overflow in MethodSignatureMapper
#KT-49222 Fixed
2021-10-15 01:24:49 +03:00
Artem Kobzar 99688e5c80 test(KT-47096): add tests for the uncovered behavior. 2021-10-14 14:57:35 +00:00
Igor Laevsky 50ca86838f [WASM] Fix build 2021-10-14 17:24:07 +03:00
Igor Laevsky cb5bef1535 [Wasm] Remove unnecessary testHelpers and add assertions from stdlib 2021-10-14 17:24:06 +03:00
Igor Laevsky e331a52e75 [Wasm] Mute/unmute box tests after kotlin.test support 2021-10-14 17:24:05 +03:00
Dmitry Petrov 6ba65065ee JVM add tests for KT-48544 & KT-49226 2021-10-14 17:23:12 +03:00
Artem Kobzar d2e5523180 test: adapt genericParameterResult.kt test for JS IR backend. 2021-10-14 14:05:39 +00:00
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
Denis.Zharkov 10c5d987d7 FIR: Fix exception on remaining flexible ILT in lambda
^KT-49191 Related
2021-10-14 14:01:49 +03:00
Dmitry Petrov 6f33259bc3 PSI2IR KT-49203 INVISIBLE_FAKE setter is non-referenceable 2021-10-13 18:38:23 +03:00
Dmitry Petrov 2a00def84e JVM_IR make proxy funs for inline and arrayOf funs non-synthetic 2021-10-13 16:07:53 +03:00
Svyatoslav Kuzmich 4e74e9baee [Wasm] Add test for KT-49182 2021-10-13 15:30:00 +03:00
Alexander Udalov 357f3184bf JVM IR: fix the type of IrGetField
The `irGetField` utility uses the field's own type as the type of the
resulting expression. But the field's type does not make sense outside
of the place of declaration of the field if it references a generic type
parameter of the containing class. Using this non-sensical generic type
led, for example, to an error in Ieee754 intrinsic (KT-48648).

The type of the expression should be kept as is in
JvmPropertiesLowering, i.e. taken from `expression` which the lowering
is replacing with the field access.

 #KT-48648 Fixed
2021-10-12 23:35:17 +02:00
Svyatoslav Kuzmich 279f184703 [JS] Remove failed checks based on unstable naming 2021-10-12 23:29:39 +03:00
Svyatoslav Kuzmich 3f8dce4b53 [JS IR] Support per-file mode and ES modules 2021-10-12 23:29:39 +03:00
Dmitriy Novozhilov b454fcc1e0 [FIR] Save IR dumps to .ir.txt files instead of .txt in tests
This is needed to avoid clashes between different dumps from different
  handlers
2021-10-12 17:26:36 +03:00
pyos 226306ac83 IR: check whether local declarations need to throw after Nothing return
^KT-48982 Fixed
2021-10-12 15:09:05 +02:00
Dmitry Petrov a213dad9ab JVM_IR add more tests for specialized generics and reification 2021-10-12 15:56:38 +03:00
Dmitry Petrov 0098103376 JVM_IR minor: update test 2021-10-12 15:56:36 +03:00
Dmitry Petrov b184c72e3d JVM_IR make proxy funs synthetic, fix some typos 2021-10-12 15:56:35 +03:00
Dmitry Petrov 005d3b1f6f JVM_IR pass reified type parameters in indy SAM conversion proxy 2021-10-12 15:56:33 +03:00
Dmitry Petrov 40fe67880b JVM_IR wrap function into a proxy if indy SAM-conversion becomes valid 2021-10-12 15:56:31 +03:00
Svyatoslav Kuzmich 15acc412ba [Wasm] Update testdata after coroutines support 2021-10-12 08:42:00 +03:00
Roman Artemev 686e5e7f2b [TEST] Fix test data.
Due to JS IR runner doesn't override stdout test fails.
Remove using stdout from test.
2021-10-11 21:19:28 +03:00
Sergej Jaskiewicz 360c0170be fixup! Mute the test on WASM 2021-10-11 15:57:53 +00:00
Sergej Jaskiewicz 9ee8f1e961 [JS IR] Enable StringTrimLowering for JS IR backend 2021-10-11 15:57:53 +00:00
Ilmir Usmanov 5a47eaf215 Fix @JvmInline value class tests for JS BE 2021-10-11 12:09:52 +03:00
zhelenskiy 1da46586bd Replaced deprecated inline classes with JvmInline value classes in tests 2021-10-11 12:09:51 +03:00
Ilya Goncharov b0aefd543a [JS IR] Fix offsets and add new test
[JS IR] Use TypeSubstitutor for full substitution of types

- adding new tests

[JS IR] Commonize context and use in wasm

[JS IR] Add test with receiver with callable reference

[JS IR] Add prerequisites around inlining and callable references

[JS IR] Review fixes

- Add test with bounded type parameter
- Remove redundant casts
- Use offsets for synth function
- Correct traversing

[JS IR] Not use origin for not inlined function reference

[JS IR] Move util into common place

[JS IR] Fix offsets

[JS IR] Add type parameter argument and using value in test

[JS IR] Wrap inlined callable references with reified parameters

[JS IR] Add test on callable reference inlined fun

Merge-request: KT-MR-4722
2021-10-11 09:02:08 +00:00
Artem Kobzar c9510af2c7 test(KT-47806): add tests for the uncovered behavior for generic companion function extensions. 2021-10-11 08:56:52 +00:00
Ilmir Usmanov f760cd6736 Make CHECKCAST Object not break tail-call optimization
Since CHECKCAST Object does nothing for return value of suspend
function - the function returns references only, this is safe.
 #KT-49157 Fixed
2021-10-11 06:40:26 +00:00
Dmitry Petrov 31d7d341d4 JVM_IR KT-41214 minor: update testData 2021-10-09 17:07:37 +03:00
Dmitriy Novozhilov 8fd2474b9e [Test] Generated FIR codegen tests on modern jdk 2021-10-09 17:07:37 +03:00
Dmitriy Novozhilov 63d841247c [FIR2IR] Properly setup IrClass.sealedSubclasses 2021-10-09 17:07:36 +03:00
Dmitry Petrov 146f0f4904 JVM_IR KT-41214 emit PermittedSubclasses on JDK17+ 2021-10-09 17:07:35 +03:00
Artem Kobzar dca4a8e722 fix(KT-45056, KT-47516): use enum as an IR class instead of enum entity class. 2021-10-08 16:21:49 +00:00
Ivan Kochurkin 6c7c1a7a0d [FIR] Convert REDUNDANT_MODIFIER, DEPRECATED_MODIFIER_PAIR to warnings ^KT-49073 Fixed 2021-10-08 18:52:18 +03:00
Roman Artemev 876a0d9b7b [IR] Add test about default arguments in expect declaration for HMMP
KT-45542
2021-10-08 16:07:10 +03:00
Dmitry Petrov 27860ef008 JVM_IR KT-49136 don't optimize null checks on fields and calls 2021-10-08 08:55:24 +03:00
Svyatoslav Kuzmich 9ef899ef10 [Wasm] Reuse Callable reference and SAM lowerings from JS 2021-10-08 07:24:41 +03:00
Svyatoslav Kuzmich 1ed2748334 [Wasm] Generate [K][Suspend]FunctionN on demand and support big arity 2021-10-08 07:24:41 +03:00
Svyatoslav Kuzmich aa5f98f919 [JS] Remove KJS_WITH_FULL_RUNTIME for tests that already have WITH_RUNTIME 2021-10-07 22:36:18 +03:00
Svyatoslav Kuzmich e18980b7ad [Wasm] Clean wasm testdata annotations 2021-10-07 22:36:17 +03:00
Denis.Zharkov f5da8957b4 FIR2IR: Support not found dependencies classes
^KT-49119 Relates
2021-10-07 17:26:27 +03:00
Roman Artemev 7eb0fd4762 [JS IR] Unmute fixed tests 2021-10-07 16:00:50 +03:00
Roman Artemev ed8e7c754d [IR] Add test for internal fake overrides from friend module 2021-10-07 16:00:48 +03:00
Dmitriy Novozhilov aab8870903 [Test] Migrate AbstractAsmLikeInstructionListingTest to new test infrastructure 2021-10-07 13:08:44 +03:00
Ilya Goncharov a0fb60f201 [JS IR] Use label for continue loop in tailrec
^KT-46218 fixed
2021-10-06 18:40:34 +00:00
Dmitry Petrov 3d64c91375 PSI2IR KT-49053 skip fake overrides with unresolved types in signature 2021-10-06 16:23:08 +03:00
pyos 1c3a20fab9 JVM_IR: generate $suspendImpl in interfaces as public
The visibility was the cause of KT-44533; not generating `$suspendImpl`
at all makes `super` calls impossible.

^KT-49106 Fixed
2021-10-06 15:03:51 +02:00