Commit Graph

4457 Commits

Author SHA1 Message Date
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
Igor Yakovlev 82455c849d [WASM] Lazy properties initialization 2022-01-05 13:12:32 +01:00
Igor Yakovlev e58d4163ad [WASM] Add std methods for collections 2022-01-05 13:12:32 +01:00
Igor Yakovlev adee0f1cb0 [WASM] Add kotlin.math implementation 2022-01-05 13:12:32 +01:00
Igor Laevsky cfcbe9e1e2 [Wasm] Better preserve IR types after inlining 2022-01-01 20:04:44 +02:00
Xin Wang 9ae452e489 JVM_IR generate less bytecode for for-loops if possible(KT-22334). 2021-12-31 18:29:04 +03:00
Dmitry Petrov 4ad6cfcf53 JVM_IR fix cast to not-null type
We can't rely on argument type nullability here, because it still can
hold an uninitialized value on JVM.

KT-50577 KT-35272 KT-27427
2021-12-30 13:41:17 +03:00
Alexander Udalov d5372521f1 Add tests for obsolete issues
#KT-12126
 #KT-12189
 #KT-23628
 #KT-24209
 #KT-34338
 #KT-47279
 #KT-48498
2021-12-29 17:07:03 +00:00
Dmitry Petrov 5946242d75 JVM_IR fix special bridges in mixed Java/Kotlin hierarchies
KT-50257 KT-50476
2021-12-29 13:29:19 +00:00
Ivan Kylchik 6fc56477bf Drop all tests that disable features for language version less than 3 2021-12-28 20:08:56 +03:00
Ilmir Usmanov 549ea1a3b9 If fun interface methods are already mangled, do not mangle them twice
There are two possible scenarios, when fun interface method with inline
class parameter can be compiled.

First is when we compile fun interface itself before SAM adapter. In
that case, fun interface is lowered before we lower SAM adapter. Thus,
its method is mangled and mangling in the second time is an error.

Second is when we compile SAM adapter before the fun interface. In that
case, fun interface is not lowered, and we have to mangle the method.

The only way to distinguish there two cases I can think of is to check
whether the overridden method is already mangled, in other words, check,
whether the overridden method's suffix is doubled.

 #KT-48499: Fixed
2021-12-28 17:35:12 +01:00
Evgeniy.Zhelenskiy 610429a278 [Tests] Move non-value class test to the corresponding folder 2021-12-24 00:26:18 +00:00
Mikhail Glukhikh f53cd22253 FIR: copy builder inference session when creating snapshot for locals
This commit fixes one builder inference case from KT-49925
2021-12-23 17:28:01 +03:00
Alexander Udalov 898c46c124 Minor, uncomment UInt in annotation instantiation test
KT-49998 is fixed so now it works.
2021-12-22 22:21:00 +01:00
Dmitry Petrov 915e949dbc JVM KT-49092 fix stack corruption in redundant boxing elimination 2021-12-22 05:32:26 +00:00
Xin Wang c74453d8d2 JVM_IR KT-48987 handle star projection arguments in smart casts 2021-12-22 00:48:15 +01:00
Xin Wang 944fa7e2f8 JVM IR: recover accidentally lost backingField (KT-49998) 2021-12-22 00:35:33 +01:00
Ivan Kochurkin 58dfe3d804 [FIR2IR] Reify type parameters for callee reference with vararg 2021-12-21 19:10:41 +03:00
Elena Lepilkina a4f7ed00cc [K/N] Disable test until don't fix inlining (KT-50281) 2021-12-21 12:50:07 +00:00
Dmitry Petrov 8905586cbb IR KT-50258 rewrite enum-based 'when' more carefully 2021-12-21 06:06:45 +00:00
Dmitry Petrov 976998b56c PSI2IR KT-49526 function reference type approximation hack 2021-12-17 21:06:24 +00:00
Dmitry Petrov 0805916564 IR KT-47483 handle 'Nothing' in array constructor call 2021-12-17 13:43:59 +03:00