Commit Graph

370 Commits

Author SHA1 Message Date
Igor Laevsky 0915dac1f9 [Wasm] Handle unsigned arrays in the vararg lowering 2021-11-03 18:50:06 +03:00
Svyatoslav Kuzmich 15acc412ba [Wasm] Update testdata after coroutines support 2021-10-12 08:42:00 +03:00
Ilmir Usmanov 5a47eaf215 Fix @JvmInline value class tests for JS BE 2021-10-11 12:09:52 +03:00
zhelenskiy 1da46586bd Replaced deprecated inline classes with JvmInline value classes in tests 2021-10-11 12:09:51 +03:00
Svyatoslav Kuzmich 9ef899ef10 [Wasm] Reuse Callable reference and SAM lowerings from JS 2021-10-08 07:24:41 +03:00
Svyatoslav Kuzmich 1ed2748334 [Wasm] Generate [K][Suspend]FunctionN on demand and support big arity 2021-10-08 07:24:41 +03:00
Svyatoslav Kuzmich aa5f98f919 [JS] Remove KJS_WITH_FULL_RUNTIME for tests that already have WITH_RUNTIME 2021-10-07 22:36:18 +03:00
Svyatoslav Kuzmich e18980b7ad [Wasm] Clean wasm testdata annotations 2021-10-07 22:36:17 +03:00
Ilmir Usmanov 27081231d9 Use original instead of lowered function to retrieve toString-impl
in string concatenation lowering. Otherwise, inliner tries to get
body of already lowered function, failing.
 #KT-48284 Fixed
2021-10-06 11:12:26 +00:00
pyos 337cbeded1 JVM_IR: do not move receivers on functions with inline class parameters
^KT-48993 Fixed
2021-10-05 13:34:32 +02:00
Svyatoslav Kuzmich 6eb81517a0 [Wasm] Unmute passed Wasm tests 2021-10-02 06:14:35 +00:00
Svyatoslav Kuzmich c88cde2f8b [Wasm] DONT_TARGET_WASM_BACKEND => IGNORE_BACKEND in testdata 2021-10-02 06:14:35 +00:00
Svyatoslav Kuzmich ab9a23cbfa [Wasm][Stdlib] Reuse K/N collections and StringBuilder 2021-10-01 17:18:49 +03:00
Alexander Udalov b821b26cfe JVM IR: do not try to optimize casts in TypeOperatorLowering
In case the cast value is used as a receiver to a private method call,
the cast is actually necessary, see KT-48927. Also, this optimization
has backfired once already (see kt48659_identityEqualsWithCastToAny.kt).
It seems that the best way to optimize these casts is not to generate
them in the first place, and/or use bytecode postprocessing.

Apparently the only kind of casts which need to be eliminated are those
which occur on an inline class to its supertype. Otherwise the
unsafe-coerce intrinsic is inserted at the incorrect place, and several
tests fail (uncastInlineClassToAnyAndBack.kt, genericOverride.kt,
classGenericOverride.kt).

 #KT-48927 Fixed
2021-09-30 13:32:36 +02:00
Svyatoslav Kuzmich 5c05ff48ff [Wasm] Copy property reference lowering from K/N 2021-09-27 17:07:39 +03:00
Ilmir Usmanov 11ba620647 Minor. Add tests with arrays in annotations 2021-09-21 21:07:22 +00:00
Ilmir Usmanov e74e267d16 Inline classes. Use inline class instead of underlying type
in annotations if underlying type is not nullable reference type.
Previously, it worked only for inline classes with primitive
underlying type and nullable reference type.

 #KT-44133
2021-09-21 21:07:22 +00:00
Roman Artemev 3b53c97c2c [JS IR] Fix test data 'kt -> ir -> klib -> ir -> js' aka prod mode
- fix order in dts tests
 - unmute fixed test in prod mode
 - mute filing expect-actual link test in prod mode
2021-09-13 13:44:46 +03:00
Igor Laevsky 00f61978b8 WASM: Enable exception handling tests 2021-09-08 19:56:38 +03:00
Svyatoslav Kuzmich b79719d6f5 [Wasm] Fix unit issues
- Materialize unit when its value is actually needed.
- Special-case Unit_getInstance return type at codegen. It should be a
  proper Unit object instead of a "void"
2021-09-08 19:56:26 +03:00
pyos 5e4f022c59 JVM_IR: use nullability when boxing/unboxing inline class types
Given inline class V(Any?), a coercion from (Object, V) to (Object, V?)
is boxing.

In theory, the same issue in the old backend can be fixed by making
`KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType` use
`computeExpandedTypeForInlineClass`, but for some reason this breaks a
lot of stuff.

 #KT-48430 Fixed
2021-08-31 12:05:34 +03:00
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