Commit Graph

349 Commits

Author SHA1 Message Date
Alexander Udalov 8d4f26cf84 IR: use inlineClassRepresentation in getInlineClassUnderlyingType
Looking for the primary constructor manually doesn't work if it's
private in the other module on JVM, because private declarations are
skipped in IrLazyClass.
2021-08-24 12:28:31 +02:00
Alexander Udalov d124239025 JVM IR: do not attempt to mangle function expressions
For some reasons, lambdas and function expressions are represented
slightly differently in psi2ir. Lambdas are translated to a block with a
function of origin LOCAL_FUNCTION_FOR_LAMBDA and name "<anonymous>", but
function expressions are translated to a block with DEFINED function
"<no name provided>".

Tweak the condition for detecting local functions a bit, to avoid
similar situation in the future if we add some other origins for local
functions.

 #KT-48207 Fixed
2021-08-12 13:50:23 +02:00
Igor Laevsky c526145a48 WASM: Disable bunch of tests which expose the same issue after switch to the wasm native strings 2021-08-04 16:23:37 +03:00
Mads Ager 2877f1cabe [JVM_IR] Fix check for inline class property backing in lowering.
The inline class lowering would attempt to lower a companion object
property backing field.

^KT-47762 Fixed.
2021-07-21 01:56:46 +02:00
pyos 7ae4303e1b JVM_IR: slightly refactor JvmPropertiesLowering
to make it easier to generate different kinds of synthetic methods.

 #KT-47609 Fixed
2021-07-12 22:38:44 +02:00
Ilmir Usmanov ac7538a269 Set receivers for inline class default function stub calls
Default function stubs have dispatch and receiver parameters, but
inline class methods are static by design with receivers as ordinary
parameters. So, take these parameters and set them as receivers during
lowerings.
 #KT-46230: Fixed
2021-07-12 19:46:09 +03:00
Igor Laevsky d835b3c164 WASM: Implement spread operator 2021-07-02 15:39:29 +03:00
Roman Artemev 09d30c91bf [JS TESTS] Disable mangler checker in tests 2021-07-01 17:40:41 +03:00
Georgy Bronnikov 40872dd4ca JVM_IR: fix parallel compilation
Non-static inline functions that return inline
classes need to be tracked when copying files for by-file lowering.

FIXED: KT-45680
2021-06-22 02:22:36 +03:00
Andrey Zinovyev 3572a96bb9 [FIR] Lookup in local sources in default imports based on the flag
Reuse ALLOW_KOTLIN_PACKAGE for that
2021-06-08 08:23:25 +00:00
pyos d5d3d9f112 Add regression tests for KT-46890 and other stuff 2021-06-03 12:35:25 +03:00
Alexander Udalov 8dee36d420 Tests: do not add transitive dependencies in multi-module tests
Prefer to have all module dependencies, including dependencies on
stdlib/reflect, declared explicitly. This allows to have tests on
situations like the one in KT-45308: three modules A<-B<-C, where C
doesn't depend on A, which was compiling correctly with the old JVM
backend before 1.5, but started to fail with JVM IR in 1.5.

Also simplify the code a bit, remove duplicated logic.
2021-05-20 15:58:05 +02:00
Ilmir Usmanov 9fe503eeb3 Minor. Add regression test
#KT-45685 Fixed
2021-05-19 12:45:26 +02:00
Dmitry Petrov 851980e36f JVM_IR KT-45103 optimize direct invoke for lambdas and callable refs 2021-05-18 22:20:12 +03:00
Steven Schäfer b2378620c3 JVM IR: Fix handling of anonymous initializers in inline classes (#4372)
Fixes KT-46554
2021-05-13 18:40:26 +02:00
Ilmir Usmanov 640d263ae1 Do not unbox nullable Result, since before usage it is coerced
#KT-46505
2021-05-11 05:49:24 +02:00
pyos 656c2496a6 JVM_IR: omit bound receiver in IrExpressionLambdaImpl parameters
and remove a hack intended to replace the missing type conversions this
caused.

 #KT-46505 Fixed
2021-05-11 05:49:20 +02:00
Mads Ager b6fa28ea81 [JVM_IR] Deal with inline-class arguments in large arity lambdas.
FunctionNVarargBridgeLowering checked the name of the method instead
of whether the method overrides an invoke method. That doesn't work
when the name of the function gets mangled because of inline class
arguments.

Fixed KT-45084.
2021-05-06 17:27:59 +02:00
Steven Schäfer 84d78035e4 JVM IR: Avoid double mangling of function reference invoke methods 2021-04-29 13:10:43 +02:00
Alexander Udalov 21e9bd7ea2 Add regression tests for obsolete issues
#KT-9304
 #KT-14961
 #KT-16549
 #KT-21080
 #KT-28234
 #KT-30102
 #KT-31994
 #KT-34291
 #KT-38099
 #KT-41174
 #KT-44622
 #KT-44701
 #KT-44781
 #KT-44849
 #KT-44978
 #KT-45081
 #KT-45286
 #KT-45383
 #KT-45444
 #KT-45907
2021-04-20 21:24:29 +02:00
Ilmir Usmanov 74b1fdcc60 Minor. Add regression test
#KT-45991
2021-04-14 10:48:59 +02:00
Ilmir Usmanov 19b1b48e87 Minor. Add tests to check returning inline class from default method
#KT-45539 Obsolete
2021-04-14 10:48:54 +02:00
Ilmir Usmanov bce92d824a Minor. Add tests to check returning Result from functions
Mainly, that virtual functions, returning Result, are mangled.
 #KT-45855
2021-04-09 22:09:03 +03:00
Alexander Udalov c17b6c59f8 JVM IR: add isInlineClassType, use it instead of isInlined 2021-03-26 18:57:01 +01:00
Steven Schäfer d0424465b8 JVM IR: Resolve fake overrides when calculating return types (KT-44867) 2021-03-18 16:02:35 +01:00
Ilmir Usmanov e47715f52b Minor. Add tests with returning inline class from SAM adapter 2021-03-16 20:57:05 +01:00
Ilmir Usmanov c9f41a2440 Minor. Ignore tests on WASM 2021-03-15 06:14:44 +01:00
Ilmir Usmanov 149064803d JVM_IR: Do not unbox Result argument inside java SAM adapters
#KT-45259
2021-03-15 06:14:42 +01:00
Ilmir Usmanov 4099dfc7e0 JVM_IR: Do not unbox Result argument inside SAM adapters
#KT-45259 Fixed
2021-03-15 06:14:40 +01:00
Ilmir Usmanov 6429ac17d8 Revert "Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error"
This reverts commit bad197e075.
2021-03-12 17:51:21 +01:00
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