Commit Graph

15277 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
Dmitriy Novozhilov cd578e9d13 [FIR] Fix inference in presence of Unit expected type 2022-01-20 11:25:47 +03:00
Dmitriy Novozhilov 1a3841d66d [FIR] Properly enhance raw Class type in java annotations 2022-01-20 11:25:44 +03:00
Dmitriy Novozhilov 239a330ddd [FE 1.0] Add test for KT-50850 2022-01-20 11:25:41 +03: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
Alexander Udalov 6f6bdd8aec IR: change acceptChildren/transformChildren order in IrClass
Traverse properties of supertypes first, and then handle thisReceiver.
This will simplify transition to auto-generated IR.
2022-01-19 17:50:35 +01:00
Dmitriy Novozhilov 345fdc214b [FIR] Store enhanced functions and properties in session component
Previously enhanced symbols were cached inside SignatureEnhancement,
  which is created independently for each enhancement scope. This may
  cause creation of multiple enhanced symbols for same java declaration
  in presence of multiple scope sessions (mutithread compiler, IDE,
  separate scope session for checkers)

^KT-50858 Fixed
2022-01-19 15:24:43 +03:00
Dmitriy Novozhilov 4f967ce102 [FIR] Ignore test due to KT-50858 2022-01-19 15:24:43 +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
Pavel Kirpichenkov b4c854429f [MPP] Permit const actual properties for non-const expects
It's safe as not having const is more restrictive, therefore can be
allowed in common. Otherwise, it's not possible to declare an expect
declaration for a platform property with `const` modifier in common

KT-18856
2022-01-19 13:22:47 +03:00
Pavel Kirpichenkov a46e683c85 [MPP] Add tests for const vs non-const expect and actual properties
KT-18856
2022-01-19 13:22:46 +03:00
Denis.Zharkov b2543b7a26 Fix false negative UPPER_BOUND_VIOLATED with typealiases in supertypes
^KT-50797 Fixed
^KT-50798 Open
2022-01-19 09:52:16 +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
Dmitriy Novozhilov 5fc1e2e0cb [FIR] Don't create DNN types for flexible simple types
^KT-50788
2022-01-18 13:41:31 +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
Victor Petukhov 72a78eb423 Replace errors with warnings for type checker recursion on delegates
^KT-49477 Fixed
2022-01-17 21:27:14 +03:00
Victor Petukhov a4a2f71fca Introduce deprecation cycle for reporting errors on some illegal equality calls inside a builder inference call
^KT-43493 Fixed
2022-01-17 19:44:16 +03:00
Victor Petukhov 060af85a93 Extract checks on equality expressions into a separate checker
^KT-43493 Fixed
2022-01-17 19:44:16 +03:00
Dmitriy Novozhilov 57346bac54 [FIR] Properly handle flexible types during creation of DNNT
^KT-50788 Fixed
2022-01-17 17:59:22 +03:00
Mikhail Glukhikh 1274e2b90a Deprecate ExtensionFunctionType on a non-function types
Related to KT-43527
2022-01-14 22:20:44 +03:00
Mikhail Glukhikh d0fa3eb1d3 Forbid ExtensionFunctionType on functional types without parameters
#KT-43527 Fixed
2022-01-14 22:20:24 +03:00
Mikhail Glukhikh 0f2f6334c2 Fix error message for SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE
#KT-48907 Fixed
2022-01-14 22:20:22 +03:00
Mikhail Glukhikh 1402bb2d45 Fix error message about unsupported annotations on type parameters
#KT-48908 Fixed
2022-01-14 22:20:22 +03:00
Mikhail Glukhikh fdf336042b Provide migration of Any functions via super in abstract case
Related to KT-38078
2022-01-14 22:20:21 +03:00
Mikhail Glukhikh 390fa682b9 Forbid calls of Any functions via super if they are overridden as abstract
#KT-38078 Fixed
2022-01-14 22:20:21 +03:00
Mikhail Glukhikh b689bbf5c7 Forbid usages of super if in fact it accesses an abstract member
#KT-49017 Fixed
2022-01-14 22:20:21 +03: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
Dmitriy Novozhilov bb6c6dc45d [FE 1.0] Fix reporting of UNINITIALIZED_ENUM_ENTRY on qualified enums
^KT-41124
^KT-50758 Fixed
2022-01-14 14:26:54 +03:00
Dmitriy Novozhilov 9f870b0549 [FIR] Report errors on cycles in annotation parameter types
^KT-47932
2022-01-14 14:26:53 +03:00
Dmitriy Novozhilov e9ac24dc33 [FE 1.0] Report errors on cycles in annotation parameter types
^KT-47932
^KT-50753 Fixed
2022-01-14 14:26:52 +03:00
Dmitriy Novozhilov 139a800ff7 [FE 1.0] Prohibit array literals inside nested objects of annotation classes
^KT-39041
^KT-50749 Fixed
2022-01-14 14:26:51 +03:00
Dmitriy Novozhilov c1575edca4 [FE 1.0] Drop ArrayLiteralsInAnnotations feature
This feature was introduced in 1.2, so now it's stable part of language
  and we can drop support of disabling it
2022-01-14 14:26:50 +03:00
Dmitriy Novozhilov ff7eb79bb1 [FE 1.0] Prohibit call of constructor of functional supertype
^KT-46344
^KT-50730 Fixed
2022-01-14 14:26:50 +03:00
Dmitriy Novozhilov ecc890efe8 [FE 1.0] Fix reporting of uninitialized parameter in default values of parameters
^KT-25694
^KT-50723 Fixed
2022-01-14 14:26:49 +03:00
Mikhael Bogdanov 92e893bebe Rework Tune module graph dependencies building
#KT-50701 In progress
2022-01-14 11:22:46 +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
Denis.Zharkov 964cf937c3 Fix IllegalStateException in case of recursive T & Any upper bound
^KT-50542 Fixed
2022-01-13 12:54:47 +03: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 d87eddaf8b Improve warnings related to type parameter bounds nullability
Explicitly supply the type parameter that needs to be non-nullified

^KT-36770 Relates
2022-01-13 08:47:20 +03:00
Dmitriy Novozhilov b2b5f4a63a [FE 1.0] Don't report deprecation diagnostics about enum on it's own entries
^KT-37975 Fixed
2022-01-12 19:11:28 +03:00
Victor Petukhov 1f1b5256b0 Postpone type enhancement improvements till 1.7 due to some found broken cases unmarked by warnings before
^KT-49378 Fixed
2022-01-12 15:58:50 +03:00