Commit Graph

7804 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 52b72a7dac [FIR] Implement Int -> Long conversions for literals and operators over them
^KT-38895
^KT-50996 Fixed
^KT-51000 Fixed
^KT-51003 Fixed
^KT-51018 Fixed
2022-02-07 13:36:36 +03:00
Igor Yakovlev 81c688b207 [WASM] Unmute passing test 2022-02-03 21:25:58 +01:00
Xin Wang fdbcb64d39 JVM_IR: frame optimization for cast to IntProgression
#KT-29199
2022-02-03 17:45:06 +03:00
Mikhael Bogdanov 15e08893aa FIR: support DefinitelyNotNull types
#KT-49465 Fixed
2022-02-03 14:07:20 +01:00
Igor Yakovlev 0ae7e00ed8 Revert "[WASM] Remove ignore from passing tests"
This reverts commit a655f9da58.
2022-02-02 16:44:48 +03:00
Denis.Zharkov 772579143b FIR: Change semantics for combination of safe calls and operators
^KT-41034 Fixed
2022-02-01 13:12:49 +03:00
Pavel Punegov f819a10968 [K/N][test] Ignore test with synchronized java keyword 2022-02-01 11:46:35 +03:00
Dmitry Petrov beb4cf3d99 PSI2IR KT-51036 fix lambda return value generation 2022-01-31 12:18:19 +00:00
Sergej Jaskiewicz 8149189585 [JS IR] Optimize away upcasts
#KT-50212 Fixed
2022-01-28 10:03:53 +00:00
Mikhail Glukhikh 983fa4c8c7 FIR: add temporary access to Enum.getDeclaringClass (see KT-49653) 2022-01-27 17:27:39 +03:00
Sergej Jaskiewicz 4a724611d8 [JS IR] Extract varargs in bridges generated for external methods
The issue this commit fixes occurs when we have an external interface
implemented by a Kotlin class, if that interface has methods with
varargs.

Kotlin functions expect varargs passed as arrays, but JavaScript code
may be unaware of this convention.

So, when generating a bridge for external interface method
implementaion, we insert some additional logic for extracting varargs
using the JavaScript `arguments` object.

A simplified example:

```kotlin
external interface Adder {
    fun sum(vararg numbers: Int): Int
}

class AdderImpl: Adder {
    override fun sum(vararg numbers: Int) = numbers.sum()
}
```

For `AdderImpl` we generate the following JS code:
```js
AdderImpl.prototype.sum_69wd7h_k$ = function (numbers) {
  return sum(numbers);
};
AdderImpl.prototype.sum = function () {
  var numbers = new Int32Array([].slice.call(arguments));
  return this.sum_69wd7h_k$(numbers);
};
```

#KT-15223 Fixed
2022-01-27 11:06:17 +00:00
Georgy Bronnikov d2738c02cc Add test for IR serialization 2022-01-27 01:02:24 +03:00
Igor Yakovlev a655f9da58 [WASM] Remove ignore from passing tests 2022-01-26 23:40:42 +03:00
Igor Yakovlev 2ec0411a7f [WASM] DCE implementation 2022-01-26 23:40:41 +03:00
Ilmir Usmanov da80ac008b Make CHECKCAST not break TCO
So, treat CHECKCASTs as { POP, Unit } sequences. If the CHECKCAST is
between suspension point and ARETURN, put check for COROUTINE_SUSPENDED
before it and return if the suspension point is suspended.

This is safe, since if the function throws CCE, it will be thrown from
the last state in state-machine and we cannot reenter the function
during resume. So, in case of CHECKCAST throwing CCE the behavior is the
same, whether we have state-machine or not.

We do not need to disable TCO in some cases, as we do for functions,
returning Unit, since in latter case suspend function, returning Unit
might appear as returning non-Unit during resumption due to missing
{ POP, Unit } sequence, which is not executed, since the function is
tail-call. However, in case of functions, returning non-Unit there is
no such concern, since we do not POP result of suspension point, but
rather, return it after CHECKCAST.

 #KT-50835 Fixed
2022-01-25 03:30:22 +01:00
Xin Wang ebcc2cc3b2 PSI2IR: KT-49485 chunk ktConditions to avoid stackoverflow 2022-01-24 19:28:59 +03:00
Ivan Kochurkin ed836f28f4 [FIR2IR] Function reference type approximation hack KT-49526 2022-01-21 19:34:11 +03:00
Ivan Kochurkin 070e860669 [FIR] Fix visibility for property accessors in raw fir common 2022-01-21 19:34:10 +03:00
Mikhail Glukhikh e8be9d4861 FIR: support don't use builder inference if possible
In this commit we upgrade FIR builder inference logic from
the compiler version to 1.7. FIR-based compiler now works with
"don't use builder inference" flag always ON and supports switching
the flag "use builder inference only if needed". To do it,
ContraintSystemCompleter (FIR) and KotlinConstraintSystemCompleter (FE 1.0)
are made similar with extracting some common parts into
ConstraintSystemCompletionContext.

Test status: one BB test fails after this commit (KT-49285).
Also we have a crush in DFA logic in FIR bootstrap test and somehow
questionable behavior in FIR diagnostic test. However,
two BB tests were fixed, the 3rd case from KT-49925 were also fixed.

#KT-49925 Fixed
2022-01-20 23:46:36 +03:00
Alexander Udalov f40a0ca704 JVM IR: avoid unnecessary toIrBasedKotlinType in ExpressionCodegen
Result of calling `ExpressionCodegen.gen` was used only in two call
sites in the inliner. In all other call sites, we were doing unnecessary
work (and sometimes were even failing) by trying to construct a
KotlinType instance out from an IrType.

Note that even though the code from KT-50617 no longer fails to compile,
the underlying problem is still not solved, since the IrType for foo's
dispatch receiver is constructed incorrectly. The reason is that
SymbolTable links everything by IdSignature, which is identical for
classes with the same FQ name.

 #KT-50617 Fixed
2022-01-20 16:05:42 +01:00
Dmitry Petrov 12d8b189a9 JVM_IR KT-50856 fix generic signature for SAM proxy function 2022-01-20 10:41:55 +00:00
Xin Wang 56e5db9f0e JVM_IR KT-50074 generate tableswitch for literal string subject of when expression 2022-01-19 22:25:49 +03:00
Dmitriy Novozhilov c80cfb0fdb [FIR] Replace single supertype scope with list of scopes of supertypes in use site scopes
This big refactoring is needed to cleanup building of overrides
  mappings and prevent creating redundant intersection overrides in
  cases when there is no need in them:

```kotlin
interface A {
    fun foo()
}

interface B {
    fun foo()
}

interface C : A, B {
    override fun foo()
}
```

Before this refactoring there was next override tree:
C.foo
  intersection override (A.foo, B.foo)
    A.foo
    B.foo

Also this commit fixes special mapping of overrides in jvm scopes
  for declarations which have kotlin builtins in supertypes with
  special java mapping rules (collections, for example)
2022-01-19 15:24:43 +03:00
Ilmir Usmanov b794b0f1be Check if there is bridge by signatures instead of IR
#KT-50649 Fixed
2022-01-18 16:57:00 +03:00
Sergej Jaskiewicz ceb744b53b Revert "[JS IR] [runtime] Remove valueOf method from Long"
This reverts commit e13b6b2a90.

The significance of the breakage caused by the removal of `valueOf`
was underestimated.

#KT-50202 Open
2022-01-18 10:33:54 +00:00
Alexander Udalov f84f3cae97 Decrease operand count in tests on invokedynamic string concat
Otherwise the tests are flaky for some reason; stack overflow is thrown
from psi2ir sometimes. Probably it has something to do with the fact
that the JVM stack which is used by the compiler here is around the
default limit (which is 1M).
2022-01-17 23:59:59 +01:00
Xin Wang 60657022e0 JVM_IR: Generate counter loop for reversed array (KT-22429) 2022-01-14 21:48:07 +03:00
Evgeniy.Zhelenskiy e97ca2ada4 [Psi2Ir, Fir2Ir] Generate toString, hashCode, equals methods for MF VC 2022-01-14 13:51:57 +00:00
Evgeniy.Zhelenskiy c7edc353d3 [FIX, Frontend] Fix recursive check for multi-field value classes 2022-01-14 13:51:57 +00:00
Evgeniy.Zhelenskiy e69a973b07 [Frontend, Ir] Equality test passes 2022-01-14 13:51:57 +00:00
Evgeniy.Zhelenskiy df1de3a7d3 [JVM] Forbid non-JvmInline value classes again 2022-01-14 13:51:56 +00:00
Evgeniy.Zhelenskiy 7595f798e1 [JVM] Introduce MF Value Classes to frontend 2022-01-14 13:51:55 +00:00
Dmitry Petrov d184babda6 JVM_IR fix cast to non-null primitive type (FIR bootstrap issue) 2022-01-13 12:47:00 +00:00
Pavel Kunyavskiy afc548d5d9 [K/N] Fix equality on fun-interface constructor references
^KT-50204
2022-01-13 09:45:58 +00:00
Pavel Punegov a4123a6be9 [K/N][test] Ignore test that fails due to ^KT-50763 2022-01-13 08:31:10 +00:00
Pavel Punegov 49b6545268 [K/N][test] Ignore test that extends final ArrayList (in K/N) 2022-01-13 08:31:09 +00:00
Denis.Zharkov 9be4f818f4 FIR: Weaken some UPPER_BOUND_VIOLATED restrictions
See test data at starProjectionInsteadOutCaptured.kt

^KT-49412 Fixed
^KT-50230 Relates
^KT-48044 Fixed
2022-01-11 16:27:06 +03:00
Pavel Punegov 9df7d39536 [K/N][test] Ignore tests that fail due to the ^KT-50555 2022-01-10 09:01:06 +00:00
Pavel Punegov c4619b4871 [K/N][test] Ignore tests that fail due to the init order
These test run correctly in the new MM
2022-01-10 09:01:06 +00:00
Pavel Punegov 8744e3db74 [K/N][test] Ignore test ^KT-49422 2022-01-10 09:01:05 +00:00
Pavel Punegov 255a254619 [K/N][test] Ignore test ^KT-50289 2022-01-10 09:01:05 +00:00
Pavel Punegov 0fadf14502 [K/N][test] Ignore test ^KT-50399 2022-01-10 09:01:04 +00:00
Pavel Punegov f1fcb56348 [K/N][test] Ignore test ^KT-33091 2022-01-10 09:01:04 +00:00
Pavel Punegov da64870e89 [K/N][test] Ignore test ^KT-40137 2022-01-10 09:01:04 +00:00
Pavel Punegov 7d57819304 [K/N][test] Ignore test ^KT-41901 2022-01-10 09:01:03 +00:00
Pavel Punegov c42c918e66 [K/N][test] Ignore test ^KT-42723
ArrayList is a final type in Native
2022-01-10 09:01:03 +00:00
Pavel Punegov 94d7a4fce3 [K/N][test] Ignore test ^KT-42020 2022-01-10 09:01:02 +00:00
Pavel Punegov 8957e4e0b2 [K/N][test] Ignore test ^KT-42723 2022-01-10 09:01:02 +00:00
Pavel Punegov 5d50e02d6b [K/N][test] Ignore test ^KT-36880 2022-01-10 09:01:02 +00:00
Igor Yakovlev 82455c849d [WASM] Lazy properties initialization 2022-01-05 13:12:32 +01:00