Commit Graph

319 Commits

Author SHA1 Message Date
Dmitry Petrov 737fbe271f JVM_IR Do not generate generic signatures for lifted lambda methods 2021-03-10 21:04:11 +03:00
Pavel Punegov 95a8c60a9c Ignore test in Native backend. Test overrides kotlin.Result 2021-02-21 11:11:46 +03:00
Ilmir Usmanov cacd84390e Use erased upper bound instead of checking for inline type 2021-02-18 18:31:50 +01:00
Ilmir Usmanov 741c1a864f JVM_IR: IC: Unbox inline class argument of callable reference
if it is unbound and the underlying type is reference type.
If the underlying type is primitive, it is boxed and unboxed
correctly, otherwise, it is simply casted and not unboxed.
Additionally, generate functions for inliner with inline classes
in signature, so unboxing works.
The unboxing is removed after inlining.
 #KT-44722 Fixed
2021-02-18 18:31:48 +01:00
Ilmir Usmanov bad197e075 Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error 2021-02-16 20:59:21 +01:00
Alexander Udalov 73aa465ee9 Add tests for issues fixed in JVM IR
Note that KT-30696 is fixed only in the single-module case, and KT-42012
is not fixed fully (see KT-44855).

 #KT-30041
 #KT-30629
 #KT-30696
 #KT-30933
 #KT-32351
 #KT-32749
 #KT-38849
 #KT-42012
 #KT-42990
 #KT-44234
 #KT-44529
 #KT-44631
 #KT-44647
2021-02-10 21:42:10 +01:00
Ilmir Usmanov 8af9ce1e0b Minor. Ignore test on WASM 2021-02-09 12:31:14 +01:00
Ilmir Usmanov 275fef94fe JVM_IR. Do not mangle callable reference constructor call
#KT-44703 Fixed
2021-02-09 12:31:11 +01:00
Ilmir Usmanov a30a961cf5 Minor. Throw exceptions in test coroutine builders 2021-02-03 19:18:24 +01:00
Alexander Udalov 5480faf5c5 Add tests for issues fixed in JVM IR and other obsolete issues
#KT-6007
 #KT-16445
 #KT-17753
 #KT-22488
 #KT-23881
 #KT-24135
 #KT-26360
 #KT-27427
 #KT-27449
 #KT-27830
 #KT-28042
 #KT-29595
 #KT-30708
 #KT-32793
2021-02-01 18:29:59 +01:00
Dmitry Petrov 4ec369ac5b JVM_IR fix special bridge generation for inline classes 2021-02-01 17:57:58 +03:00
Mikhael Bogdanov 1c612376dd Disable some android box test 2021-01-28 18:30:48 +01:00
Mikhael Bogdanov 0ad24f5346 Enable Android box test 2021-01-28 18:01:21 +01:00
Ilmir Usmanov 952576e98f JVM_IR: Do not unbox Result parameter if it not only one inline class
parameter, since in this case, the compiler generates a bridge, where
the result is unboxed.
2021-01-20 18:30:00 +01:00
Ilmir Usmanov d48f92775b JVM_IR: Do not unbox Result parameter in invoke if there is a bridge
since the bridge unboxes it.

 #KT-44141 Fixed
2021-01-20 18:29:58 +01:00
Ilmir Usmanov cce9469e6a JVM_IR: Do not unbox Result parameter in Result methods
#KT-44140 Fixed
2021-01-20 06:27:15 +01:00
Svyatoslav Kuzmich b6ad1584c9 [Wasm] Improve interface method dispatch
- Use typed Wasm tables for each interface method to avoid runtime
  function type check

- Use linear search by implemented interface rather than by individual
  virtual function signature
2020-12-30 19:29:10 +03:00
Ilmir Usmanov 80289e4a3f IC Mangling: Generate inline class literal instead of underlying type
literal in annotations.
 #KT-30280 Fixed
2020-12-30 03:31:08 +01:00
Svyatoslav Kuzmich 672859d447 [Wasm] Support init blocks in inline classes 2020-12-25 17:00:23 +03:00
Svyatoslav Kuzmich 0945c110bf [JS IR] Support init blocks in inline classes 2020-12-25 17:00:23 +03:00
Ilmir Usmanov f49cf2d5ca IC Mangling: correctly mangle inline default functions
#KT-43682 Fixed
2020-12-23 18:13:09 +01:00
Ilmir Usmanov 2b0a99b7b0 IC Mangling: Use correct java field type if the type is inline class
in old JVM BE.
 #KT-26445
2020-12-11 17:51:37 +01:00
Ilmir Usmanov 0cab69a7a0 IC Mangling: Do not mangle functions with inline classes from Java
in old JVM BE. Map types to boxed variants, when mapping signatures.
 #KT-26445
2020-12-11 17:51:30 +01:00
Ilmir Usmanov dccfb33bcc JVM_IR: Unbox argument of type kotlin.Result
if the argument has different type in parent: either generic or Any.
 #KT-41163 Fixed
 #KT-43536 Fixed
2020-12-10 08:27:32 +01:00
Ilmir Usmanov 0dc5f3ac00 IC: call JvmDefault method of inline class using boxed receiver
#KT-43698 Fixed
2020-12-08 04:33:36 +01:00
Ilmir Usmanov 0d55c9108d IC: Forbid inner classes inside inline classes
#KT-43067 Fixed
2020-12-04 05:45:53 +01:00
Ilmir Usmanov 15c325cf10 Value classes: Allow nested inline classes 2020-12-04 05:45:51 +01:00
Dmitry Petrov e6a3e38c4d JVM_IR no static inline class members for Kotlin JvmDefault methods
KT-43698 KT-43051
2020-12-02 20:04:13 +03:00
Georgy Bronnikov b0e2d5637d Mute a test for WASM 2020-12-01 18:37:55 +03:00
Georgy Bronnikov 4607eca987 JVM_IR: bug fix in classFileContainsMethod
The old test sequence failed for toplevel functions because of file
class wrappers, so that the second branch was never invoked.
2020-12-01 13:15:51 +03:00
Georgy Bronnikov 6381d97aab JVM_IR: compute classId on IR structures 2020-11-27 10:56:07 +03:00
Dmitry Petrov 7cc6204d6b Minor: update testData 2020-11-25 17:31:47 +03:00
Dmitry Petrov e5dce9f994 KT-42933 inline class backing field can't be static 2020-11-25 17:31:46 +03:00
Dmitry Petrov 3a166f3592 KT-43525 forbid @JvmOverloads on mangled funs and hidden constructors 2020-11-24 16:06:20 +03:00
Ilmir Usmanov f7164404c9 IC mangling: Ignore FIR tests 2020-11-19 17:39:26 +01:00
Ilmir Usmanov c62093f54c IC mangling: Change mangling rules
1. Use 'x' for each parameter, which is not an inline class, every
possible clash is handled by signature rather than name. This change
makes more API changes binary-compatible. So, the changes are in line
with the vision of inline classes are value classes, like primitives.

2. Take return type into account when mangling a function if the return
type is inline class. Otherwise, boxing bridge will not be generated,
which leads to CCE at runtime.
2020-11-19 17:39:24 +01:00
Dmitry Petrov 3d2f5f4bc1 KT-42018 explicitly cast inline class values in safe-as 2020-11-18 18:51:15 +03:00
Denis Zharkov f97cc0b62d FIR: Rework receivers processing in resolution
- Put extensionReceiver to candidate even if it's explicit (for sake of clarity)
- Split CheckReceiver (dispatch part should only check nullability)
2020-11-16 15:50:39 +03:00
Dmitry Petrov 5d76df6e1a KT-43045 mangle function name for fake override with default impl 2020-11-13 16:15:29 +03:00
Svyatoslav Kuzmich fdd7fa5aea [Wasm] Mute codegen box tests 2020-11-09 16:04:43 +03:00
Ilmir Usmanov 1376fed1d4 Support non-public inline class constructors
#KT-28056 Fixed
2020-11-03 12:10:21 +01:00
Ilmir Usmanov 28e148d35a Old JVM: support init blocks in inline classes
#KT-28055 Fixed
2020-10-29 20:38:03 +01:00
Ilmir Usmanov 999604541e JVM_IR: Support init blocks in inline classes
Put their content to constructor-impl, so they are called during
constructor call, but they are not called during boxing, because
box-impl calls <init> and not constructor-impl.

 #KT-28055 In progress
2020-10-29 20:38:01 +01:00
Alexander Udalov ad5b6da273 JVM IR: substitute generic type for inline class replacement function calls
The main change here is in `JvmInlineClassLowering.visitFunctionAccess`,
where we now store the substituted return type of the function as the
type of the call expression. Without it, the call could have a
meaningless type, e.g. some `T` which is inaccessible at that place, and
that could backfire in subsequent lowerings in codegen. For example, in
the `stringPlus.kt` test, it would prevent the code in
`FlattenStringConcatenationLowering.isStringPlusCall` from recognizing
and replacing the `String.plus` call, leading to a codegen exception.

Other changes are mostly cosmetics to make the code similar to
`visitFunctionReference`, and preventive optimizations for the case when
the substitution map is empty.
2020-10-28 16:46:28 +01:00
Ilmir Usmanov a775fa195b Unbox inline class parameter of lambda if underlying type is Any or Any?
The inline class is boxed when we pass it as lambda argument, now we
unbox it. If the underlying type is not Any or Any?, bridge method does
the unboxing.

 #KT-32450 Fixed
 #KT-39923 Fixed
 #KT-32228 Fixed
 #KT-40282 Fixed
2020-10-26 17:34:37 +01:00
Dmitry Petrov ee5edf4caa JVM_IR fix 'remove' in inline class implementing MutableCollection 2020-10-16 00:02:12 +03:00
Alexander Udalov 1df3bafbaf Minor, fix and unmute fieldNameClash.kt test
#KT-31927
2020-10-14 16:53:58 +02:00
Denis Zharkov 3dfbd36f15 FIR: Unmute passing blackbox tests 2020-10-01 17:49:02 +03:00
Alexander Udalov ae6d89b100 Minor, mute new test for FIR 2020-09-25 16:50:58 +02:00
pyos bd6ead0467 JVM_IR: check for null when converting unboxed inline classes to strings
`C?` can be unboxed into `T?` if if wraps a reference type `T!!`, but in
this case `null` is not a valid value to pass to `toString-impl`.

 #KT-42005 Fixed
2020-09-25 16:50:34 +02:00