Commit Graph

7804 Commits

Author SHA1 Message Date
Evgeniy.Zhelenskiy 6107caa8e2 [FE1.0, FIR] Support secondary constructors for Value Classes
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:35 +00:00
Evgeniy.Zhelenskiy 8c3fa6f09f [IR] Escape removing extra boxes if no box was are in the function
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:35 +00:00
Evgeniy.Zhelenskiy 89d5592622 [IR] Support function references
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:34 +00:00
Evgeniy.Zhelenskiy 51e76aa19a [IR] Support default arguments
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:33 +00:00
Mikhail Glukhikh c698d060c6 FIR2IR: support static fake overrides for fields (related to KT-53441)
#KT-54921 Fixed
2022-11-28 17:27:50 +00:00
Sergej Jaskiewicz aa1b18b0c8 [IR] Prevent infinite recursion when rendering bound symbol references
Refactor the renderer, make BoundSymbolReferenceRenderer a static class
to prevent calling RenderIrElementVisitor's methods from it to avoid
infinite recursion in the future.

^KT-52677 Fixed
2022-11-28 16:43:53 +00:00
vladislav.grechko 50e92d2238 Add null checks in constructors taking value class types
^KT-53492: Fixed
2022-11-24 20:12:05 +00:00
Vladislav Grechko cd6e865fb3 Improve support of 'lateinit' modifier
- Allow 'lateinit' for inline classes which underlying type
is suitable for 'lateinit'

- K2: report all problems related to 'lateinit' modifier

^KT-55052: Fixed
2022-11-24 19:47:21 +00:00
vladislav.grechko e0c13e5276 Fix addAll & putAll invocations on inline mutable collections
^KT-54950: Fixed
2022-11-24 19:27:42 +00:00
Ivan Kylchik a1477983ba Properly handle vararg interpretation for classic frontend
#KT-55108 Fixed
2022-11-24 11:07:07 +00:00
Denis.Zharkov f7d8fd54ca K2: Fix deserialization of flexible type based on type parameter
It's anyway safe to use avoidComprehensiveCheck = true because
during deserialization we're sure that we need DNN type because
it's been serialized as such.
2022-11-24 09:39:58 +00:00
Ivan Kochurkin 194d1cfccf [FIR] Filter out incorrect library provides for dependencyProviders
Get rid of providers duplication
2022-11-23 18:29:29 +00:00
Ivan Kochurkin 8883de3f00 [FIR] Don't resolve Enum.declaringClass and Enum.getDeclaringClass
^KT-53946 Fixed
2022-11-23 18:29:29 +00:00
Dmitriy Novozhilov 1b27d60307 [FIR] Support @OnlyInputTypes annotation
^KT-54807 Fixed
2022-11-22 15:46:17 +00:00
pyos 67a6785f63 FIR DFA: move eq/notEq null-to-type translation to LogicSystem
This makes the `returns() implies` checker slightly cleaner, and also
fixes the case that I've missed where in RHS of `x ?:` type of `x` was
not set to `Nothing?`.
2022-11-22 15:44:37 +00:00
vladislav.grechko 5ec2f1ad92 Get rid of redundant boxing when comparing inline class instances
^KT-33722: Fixed
2022-11-18 23:14:03 +00:00
vladislav.grechko 36b8ba8df3 Improve support of custom equals in inline classes
- Ensure that typed equals parameter's type is a star projection of
  corresponding inline class

- Make possible to declare typed equals that returns 'Nothing'

- Forbid type parameters in typed equals operator declaration

^KT-54909 fixed
^KT-54910 fixed
2022-11-17 15:35:14 +01:00
Pavel Mikhailovskii 4436ce22b0 Generate meaningful bytecode names for extension receivers in INDY lambdas 2022-11-15 15:38:34 +00:00
Svyatoslav Kuzmich 4ba780be26 [Wasm] unmute test 2022-11-14 13:55:39 +01:00
Svyatoslav Kuzmich 78bd6dbdcd [Wasm] Allow implementing function interfaces 2022-11-14 11:23:18 +01:00
Mikhael Bogdanov edc54524aa Xjdk-release: support mixed compilation of Java and Kotlin
#KT-52815 Fixed
2022-11-14 06:57:12 +00:00
Ilya Chernikov 7e4ee399c8 FIR JS: temporarily mute remaining codegen tests 2022-11-12 16:28:25 +01:00
Ilya Chernikov 78ca733c38 FIR JS: add K2 variants of all other JS tests
except tests that are not possible to add without some modifications in
the test infra. See todos on the commented-out test declarations
2022-11-12 16:28:24 +01:00
Ilya Chernikov 4e4511bba2 FIR2IR: convert enums with non-primary default ctor correctly
see added test for example
2022-11-12 16:28:24 +01:00
Ilya Chernikov 44cce3ad52 FIR JS: mute remaining tests for now 2022-11-12 16:28:23 +01:00
Ilya Chernikov 5b3816cce5 Test infra: refactor IGNORE_BACKEND directive
treat it as a general one, introduce *_K1 and *_K2 variants for
more specific ignoring
2022-11-12 16:28:23 +01:00
Mikhail Glukhikh 3a81174a4c FIR2IR: support static fake overrides (functions) #KT-53441 Fixed 2022-11-11 13:30:36 +00:00
pyos e2a83a0ed0 FIR: unwrap intersection overrides when looking for owner class
But not substitution overrides! This is important if the method called
is an intersection override where one of the intersected types is a
subtype of a generic type.
2022-11-11 13:30:32 +00:00
Yan Zhulanow 0a8b9c821c [FE] Add missing 'ClassId' check in Kotlin class loading (KTIJ-23435)
'findKotlinClassOrContent()' does not really distinguish between
outer class names and package path components, so it might return
'foo/bar/Baz.Boo' for 'foo/bar/Baz/Boo'. Possibly because
 'findKotlinClassOrContent()' potentially returns a raw byte array,
 ClassId checking is supposed to be performed in
 'extractClassMetadata()'. For Java, it happens inside
 'FirJavaFacade.findClass()', yet for Kotlin the check was absent.
2022-11-11 11:28:37 +00:00
pyos fbb54f0300 FIR: fix Clonable detection condition in inline checker 2022-11-10 11:34:53 +01:00
Mads Ager 636024f676 [JVM] Retain deprecated status for interface companion const property.
Create the field directly and maintain the fact that its corresponding
property is the companion object property. That property has the
deprecated annotation which puts the deprecated marker on the field
when code generating the field.

^KT-54840 Fixed
2022-11-09 23:15:31 +01:00
Pavel Mikhailovskii 252e97663b KT-54784 Fix function inlining in init sections 2022-11-09 17:15:37 +00:00
Alexander Udalov d7a58a7c6c Keep track of array types in OptimizationBasicInterpreter
Merging array types with different element types, for example
`[Lj/l/String;` and `[Lj/l/Object;`, now produces `[Lj/l/Object;`
(instead of `Lj/l/Object;`), which allows for more precise tracking of
null values because we assume that AALOAD on a non-array typed value is
possible only if that value is null.

 #KT-54802 Fixed
2022-11-07 17:22:38 +01:00
Dmitriy Novozhilov 2fd8bf9153 [FIR] Don't analyze lambda twice inside delegate inference
This is a workaround for ^KT-54767
2022-11-03 08:30:09 +00:00
Dmitriy Novozhilov 7af43176ce [FIR] Add optin on API of updating type of receiver values. KT-54708 2022-11-03 08:30:09 +00:00
Dmitriy Novozhilov 089d907fd4 [FIR] Ignore leaked internal types because of KT-54517 2022-11-03 08:30:08 +00:00
Xin Wang 4d9c2d3d14 Don't treat java constructor as 'hidden' one
Fix KT-54656
2022-11-02 12:56:38 +01:00
Igor Yakovlev 033e2c45f1 [WASM] Caching string literals in global pool 2022-11-01 13:15:09 +00:00
Alexander Udalov 3d00c173f3 Fix binary compatibility for inlined local delegated properies
#KT-54650 Fixed
2022-11-01 12:34:33 +01:00
Alexander Udalov 54ab66cd4e Add regression test for KT-54707 2022-11-01 11:24:03 +01:00
Ilya Goncharov 372a512c91 [JS IR] Add case with bridge for method with default parameters 2022-10-31 16:08:24 +00:00
Sergej Jaskiewicz b429e2f34f Remove a test that doesn't make sense anymore 2022-10-27 11:28:01 +00:00
Sergej Jaskiewicz 6a40a7e471 [JS IR] Don't forget to enable lazy property initialization 2022-10-27 11:27:59 +00:00
Dmitriy Novozhilov 027b1f861c [FIR] Update return type of delegated callables in ReturnTypeCalculator
^KT-54654 Fixed
2022-10-27 11:08:55 +00:00
Dmitriy Novozhilov f441151eab [FIR] Fix order of supertype scopes for supertypes of companion object
^KT-54645 Fixed
2022-10-27 11:08:54 +00:00
Dmitriy Novozhilov d54503e66c [Test] Add test for KT-54645 2022-10-27 11:08:54 +00:00
Nikolay Lunyak 7e323f8ac6 [FIR] KT-54692: Fix compiler crash on UInt.shl
Merge-request: KT-MR-7513
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2022-10-27 10:40:06 +00:00
Simon Ogorodnik 2cf8f75a90 KT-53255. Fix StackOverflow during IR verification from K2
In FIR we desugar when with multiple conditions leading to same block
as tree of OR expressions

Given
```
when(some) {
  "a", "b", "c" -> {}
  else -> {}
}
```

actually desugared into
```
when(val <subj> = some) {
  <subj> == "a" || <subj> == "b" || <subj> == "c" -> {}
  else -> {}
}
```

There is a multiple ways of how we can organize such expressions in FIR
Previously it was just nesting-chain of OR expressions

While the most efficient way in terms of required stack depth is
a balanced tree

KT-53255
2022-10-26 17:44:46 +00:00
Simon Ogorodnik ac8cae16ba KT-53255. Extend test for long when expression 2022-10-26 17:44:46 +00:00
Ilya Goncharov fd5fba6f09 [JS IR] Fix case with bridge with nested classes
^KT-54686 fixed
2022-10-26 12:56:03 +00:00