Commit Graph

5232 Commits

Author SHA1 Message Date
Alexander Udalov d48307ec34 JVM IR: do not copy type parameters into suspend lambda classes
Declarations inside that class are referencing the type parameters of
the containing function anyway, since we don't do any remapping. So the
resulting IR is slightly more correct, and doesn't lead to type
parameter/argument size mismatch error on IrBased/Wrapped-descriptors.

This reverts a part of 01da7f289b, which looks like it was no longer
necessary after 8d0ffa1444.

 #KT-42028 Fixed
2020-09-23 12:21:37 +02:00
Mikhail Glukhikh b64b32e06b FIR: keep captured types in substitution scope 2020-09-23 09:00:57 +03:00
Georgy Bronnikov 8990344bb2 Varargs: add test 2020-09-22 23:53:41 +03:00
Georgy Bronnikov 67d7bf3269 IR: take care of supertypes when copying IrTypeParameters 2020-09-22 23:53:40 +03:00
Georgy Bronnikov 382f423ab9 Mute a test under DCE 2020-09-22 23:53:40 +03:00
Georgy Bronnikov 33a2c69122 IR: remap types in LocalDeclarationsLowering 2020-09-22 23:53:40 +03:00
Mikhael Bogdanov 7d4a734791 Fix nullability of typePath parameter
#KT-41484 Fixed
2020-09-22 15:37:02 +02:00
Dmitry Petrov 0539b2b389 Mute some FIR->JVM_IR box tests
FIR generates delegated class members incorrectly (with non-substituted
signatures).
2020-09-22 16:32:27 +03:00
Dmitry Petrov c03573fc18 JVM_IR fix override equivalence check for collection stub generation
KT-42043 KT-42033
2020-09-22 15:26:34 +03:00
Mark Punzalan 8cac3f654c [FIR] Handle pre/postfix dec/increment of labeled expression 2020-09-22 11:06:27 +03:00
Mark Punzalan f55ff8eb1b [FIR] Capture receiver for pre/postfix dec/increment of qualified access
This prevents double-evaluation of the receiver expression, which may
have side-effects. E.g.: a.b++
2020-09-22 10:20:46 +03:00
pyos 6e143a2656 JVM_IR: collect free type parameters when serializing FIR metadata
The "free" in "createFreeFakeLambdaDescriptor" and such refers to the
fact that there are no references to type parameters from outside the
current declaration. This is necessary because at the point where the
metadata is written, the type parameters may not even be in scope (e.g.
local delegated properties are serialized at class level, but may refer
to function-scope type parameters).
2020-09-22 09:35:50 +03:00
pyos aa58ed9234 JVM_IR: partially implement FIR local delegated property reflection
Type parameter references are broken, just like for lambdas. Also, the
code is super ugly.
2020-09-22 09:35:45 +03:00
Dmitry Petrov ee3ada4e55 JVM_IR KT-40304 KT-41998 special handling for 'removeAt' 2020-09-18 14:27:36 +03:00
Ilmir Usmanov b406022315 Mark Unit unspillable if it is merged with unspillable Unit
#KT-42004: Fixed
2020-09-17 23:23:14 +02:00
Ilmir Usmanov dfd7f33bd3 Minor. Add test with reified type parameter 2020-09-17 16:14:07 +02:00
Ilmir Usmanov 9ecf5dc9af Support is/as operations on suspend callable reference conversion 2020-09-17 16:14:04 +02:00
Jinseong Jeon d1ba69044e FIR: update the type of anonymous function as SAM 2020-09-17 12:45:26 +03:00
Ilmir Usmanov f960201f52 Ignore type parameters of inline class
when checking whether we can return unboxed inline class
from suspend function
2020-09-17 11:20:48 +02:00
Dmitry Petrov fbfe56e0cc JVM_IR KT-41915 compare Kotlin signatures when adding collection stubs 2020-09-17 11:37:29 +03:00
Jinseong Jeon 72dea05854 FIR2IR: approximate type argument if reified 2020-09-17 09:43:46 +03:00
Mikhail Glukhikh 0c13d3197c [FIR] Fix non-serializable type argument at the end of resolve 2020-09-16 16:53:29 +03:00
Dmitry Petrov 54d5494ecd JVM_IR special handling for 'remove' collection method stub 2020-09-16 15:36:16 +03:00
Ilmir Usmanov 58146c4452 Keep DebugMetadata annotation when regenerate lambda with state-machine
When a suspend lambda does not capture crossinline lambda, it is
generated with as state-machine, since it does not inline anything.
However, when regenerating, the inliner used to remove all DebugMetadata
annotations to avoid duplication. This lead to missing annotation if
the lambda is regenerated, but state-machine is not regenerated.
This change fixes the blind spot by readding the annotation after
regeneration.
 #KT-41789 Fixed
2020-09-15 19:57:02 +02:00
Pavel Kirpichenkov b102042dd8 Minor: add regression test for KT-41806 2020-09-15 10:52:47 +03:00
Jinseong Jeon 2fad935ce2 FIR deserializer: load inline/external flags properly 2020-09-15 10:21:35 +03:00
Pavel Punegov fc35b5398c Mute test in Native 2020-09-14 23:41:47 +03:00
Mikhail Glukhikh e1b4108e4a [FIR2IR] Mute some tests due to captured type problems 2020-09-14 18:08:30 +03:00
Mikhail Glukhikh 4605a65f41 [FIR] Good test data fixes (around captured types) 2020-09-14 17:56:39 +03:00
Dmitry Petrov b395771d01 KT-37050 don't generate redundant special bridges
Loosely based on https://github.com/JetBrains/kotlin/pull/3662
2020-09-14 16:13:34 +03:00
Alexander Udalov f0282bcfdf JVM IR: add module name for internal functions before "$default"
The change is a bit complicated because the name mapping logic is
refactored so that we would compute the needed suffix first (either
module name, or multifile part class name), and then shove it into the
mangled name between the original function name and "$default", if the
function in question is the default arguments adapter.

The main motivation for this change was to fix KT-41809, but as a side
effect, private functions with default arguments in multifile parts now
also contain the file name, just like normal private functions.

 #KT-41809 Fixed
2020-09-14 13:18:24 +02:00
Alexander Udalov 2a0f64ebcb JVM IR: do not generate Deprecated(HIDDEN) class as synthetic
#KT-41810 Fixed
2020-09-14 13:18:24 +02:00
Dmitriy Novozhilov 535898c8a4 [FIR] Fix processing integer operator calls for not integer types 2020-09-14 10:57:10 +03:00
Jinseong Jeon 0bd7de158c FIR: update suspend lambda type during declaration resolution 2020-09-14 10:20:45 +03:00
Jinseong Jeon 680dd64211 FIR2IR: pick return target based on matched IrFunction 2020-09-14 10:09:51 +03:00
Alexander Udalov 9250d86915 JVM IR: generate field for private companion object in interface as synthetic 2020-09-13 09:13:27 +02:00
Alexander Udalov 2f86554d5a IR: don't produce fake overrides for static and private declarations
Note that only irrelevantStaticProperty.kt failed before this change.
Having private declarations caused no problems, but it seems incorrect,
so it's fixed now and irrelevantPrivateDeclarations is added just in
case.

 #KT-41848 Fixed
2020-09-12 20:01:34 +02:00
Alexander Gorshenev 744f290fc4 A proper modality calculation was missing in IR fake override construction algorithm
#KT-41765 Fixed
2020-09-11 18:56:17 +03:00
Dmitriy Novozhilov 1dc3c93efa [FIR] Don't assume types with not found symbol as error types 2020-09-11 12:13:33 +03:00
Dmitriy Novozhilov 7f692be11e [FIR] Properly detect callable reference type according conversions 2020-09-11 12:13:33 +03:00
Mikhail Glukhikh ec93e5886a [FIR2IR] Fix generation of accessors' extension receiver (f/o case) 2020-09-11 11:43:00 +03:00
Jinseong Jeon 6de8ba40c1 FIR: initial support of suspend conversion on arguments 2020-09-10 11:31:24 +03:00
Jinseong Jeon 49679f3145 FIR: map arguments for overloading indexed access operator 2020-09-10 11:25:36 +03:00
Ilmir Usmanov 52f9569d33 Generate CHECKCAST Object inside the markers
otherwise, the unboxing interferes with bytecode analysis.
2020-09-09 17:43:42 +02:00
Ilmir Usmanov e8a451072e Minor. Add tests with same JvmType in covariant override 2020-09-09 17:43:41 +02:00
Ilmir Usmanov 7cbd067460 Add tests with resume path 2020-09-09 17:43:39 +02:00
Ilmir Usmanov 1c97eafea8 Check for COROUTINE_SUSPENDED inside callable reference
#KT-41429 Fixed
2020-09-09 17:43:37 +02:00
Ilmir Usmanov ccc5b7afe0 Box inline class in resume path of suspend call
#KT-41429
2020-09-09 17:43:35 +02:00
Ilmir Usmanov 023cdd7cd4 Support not boxing inline class of reference class
even if the class is other than Any.
 #KT-41429 In progress
2020-09-09 17:43:34 +02:00
Alexander Udalov 3d7619421f JVM IR: fix exception on star projection in type parameter upper bound
#KT-41761 Fixed
2020-09-09 17:07:52 +02:00