Commit Graph

585 Commits

Author SHA1 Message Date
Ilmir Usmanov 00a08fc6a4 Minor. Add tests and comment about copying generic parameters to
constructor, but not function reference to the constructor.

 #KT-32162
2022-02-15 08:11:19 +01:00
Ilmir Usmanov 84ccf412cb Minor. Ignore some tests on old JVM, JS_IR, JS and WASM
#KT-32162
2022-02-15 08:11:18 +01:00
Ilmir Usmanov 2fedb97d16 Correctly map nullable generic underlying value of inline class
if upper bound is primitive type.
 #KT-32162
2022-02-15 08:11:17 +01:00
Ilmir Usmanov cece7120df Minor. Add more tests 2022-02-15 08:11:13 +01:00
Ilmir Usmanov c8817893d4 Support default parameters of inline type with generic underlying value
#KT-32162
2022-02-15 08:11:11 +01:00
Ilmir Usmanov 4f95171472 Minor. Add tests 2022-02-15 08:11:10 +01:00
Ilmir Usmanov 9060168542 Support generic underlying type of inline class
Use upper bound in JVM representation.
 #KT-32162
2022-02-15 08:11:08 +01:00
Denis.Zharkov 58408d8a78 FIR: Fix incorrect qualifier resolution in case of type parameters
^KT-51265 Fixed
2022-02-14 17:16:22 +03:00
Victor Petukhov fd6500c167 [FE 1.0] Set a fixation priority for self type variables less than any of ready for fixation kinds
^KT-51040 Fixed
^KT-49838
2022-02-14 15:43:53 +03:00
Ilmir Usmanov 8f23fc54a4 Mangle bridges if its return type is not inline
#KT-51235 Fixed
2022-02-14 13:06:13 +01:00
Mads Ager c8cade5bf3 [FIR] Ensure qualifier resolution takes place for type aliases.
When resolving a name that is used as a receiver and all
candidates are classifier symbols, we need to perform
qualifier resolution. The code used to only do that for
regular classes, and would not perform qualifier resolution if
there was a type alias candidate.

^KT-51171 Fixed
2022-02-10 16:27:32 +03:00
Ilmir Usmanov 47ee0e5b0a Get type arguments from supertype in supercall
Otherwise, when the function has inline class parameter, we get ICE.
We do not get the error without inline class parameter, since we
substitute type parameters in limited situations, which includes
inline class lowering.

 #KT-51157 Fixed
2022-02-10 10:40:55 +01:00
Dmitriy Novozhilov 0eb526a8b4 [FE 1.0] Report warning about conflict in inherited members from deserialized dependencies
^KT-51194
^KT-51223 Fixed
2022-02-09 19:35:56 +03:00
Svyatoslav Scherbina 62c1bd0044 Native: fix using nested expect enum entry in a default argument
^KT-51156 Fixed
2022-02-09 14:41:11 +00:00
Ivan Kochurkin 5391ee91af [FIR2IR] Fix incorrect type of typealias for suspend functional type, ^KT-50997 Fixed 2022-02-07 17:21:59 +03:00
Dmitry Petrov beb4cf3d99 PSI2IR KT-51036 fix lambda return value generation 2022-01-31 12:18:19 +00:00
Ilmir Usmanov da80ac008b Make CHECKCAST not break TCO
So, treat CHECKCASTs as { POP, Unit } sequences. If the CHECKCAST is
between suspension point and ARETURN, put check for COROUTINE_SUSPENDED
before it and return if the suspension point is suspended.

This is safe, since if the function throws CCE, it will be thrown from
the last state in state-machine and we cannot reenter the function
during resume. So, in case of CHECKCAST throwing CCE the behavior is the
same, whether we have state-machine or not.

We do not need to disable TCO in some cases, as we do for functions,
returning Unit, since in latter case suspend function, returning Unit
might appear as returning non-Unit during resumption due to missing
{ POP, Unit } sequence, which is not executed, since the function is
tail-call. However, in case of functions, returning non-Unit there is
no such concern, since we do not POP result of suspension point, but
rather, return it after CHECKCAST.

 #KT-50835 Fixed
2022-01-25 03:30:22 +01:00
Alexander Udalov f40a0ca704 JVM IR: avoid unnecessary toIrBasedKotlinType in ExpressionCodegen
Result of calling `ExpressionCodegen.gen` was used only in two call
sites in the inliner. In all other call sites, we were doing unnecessary
work (and sometimes were even failing) by trying to construct a
KotlinType instance out from an IrType.

Note that even though the code from KT-50617 no longer fails to compile,
the underlying problem is still not solved, since the IrType for foo's
dispatch receiver is constructed incorrectly. The reason is that
SymbolTable links everything by IdSignature, which is identical for
classes with the same FQ name.

 #KT-50617 Fixed
2022-01-20 16:05:42 +01:00
Ilmir Usmanov b794b0f1be Check if there is bridge by signatures instead of IR
#KT-50649 Fixed
2022-01-18 16:57:00 +03:00
Evgeniy.Zhelenskiy 7595f798e1 [JVM] Introduce MF Value Classes to frontend 2022-01-14 13:51:55 +00:00
Dmitry Petrov d184babda6 JVM_IR fix cast to non-null primitive type (FIR bootstrap issue) 2022-01-13 12:47:00 +00:00
Dmitry Petrov 4ad6cfcf53 JVM_IR fix cast to not-null type
We can't rely on argument type nullability here, because it still can
hold an uninitialized value on JVM.

KT-50577 KT-35272 KT-27427
2021-12-30 13:41:17 +03:00
Alexander Udalov d5372521f1 Add tests for obsolete issues
#KT-12126
 #KT-12189
 #KT-23628
 #KT-24209
 #KT-34338
 #KT-47279
 #KT-48498
2021-12-29 17:07:03 +00:00
Dmitry Petrov 5946242d75 JVM_IR fix special bridges in mixed Java/Kotlin hierarchies
KT-50257 KT-50476
2021-12-29 13:29:19 +00:00
Ivan Kylchik 6fc56477bf Drop all tests that disable features for language version less than 3 2021-12-28 20:08:56 +03:00
Ilmir Usmanov 549ea1a3b9 If fun interface methods are already mangled, do not mangle them twice
There are two possible scenarios, when fun interface method with inline
class parameter can be compiled.

First is when we compile fun interface itself before SAM adapter. In
that case, fun interface is lowered before we lower SAM adapter. Thus,
its method is mangled and mangling in the second time is an error.

Second is when we compile SAM adapter before the fun interface. In that
case, fun interface is not lowered, and we have to mangle the method.

The only way to distinguish there two cases I can think of is to check
whether the overridden method is already mangled, in other words, check,
whether the overridden method's suffix is doubled.

 #KT-48499: Fixed
2021-12-28 17:35:12 +01:00
Evgeniy.Zhelenskiy 610429a278 [Tests] Move non-value class test to the corresponding folder 2021-12-24 00:26:18 +00:00
Dmitry Petrov 915e949dbc JVM KT-49092 fix stack corruption in redundant boxing elimination 2021-12-22 05:32:26 +00:00
Dmitry Petrov 8905586cbb IR KT-50258 rewrite enum-based 'when' more carefully 2021-12-21 06:06:45 +00:00
Dmitry Petrov 976998b56c PSI2IR KT-49526 function reference type approximation hack 2021-12-17 21:06:24 +00:00
Dmitry Petrov 0805916564 IR KT-47483 handle 'Nothing' in array constructor call 2021-12-17 13:43:59 +03:00
Dmitry Petrov 8c71e38c92 JVM_IR KT-49765 bridge for throwing stub should just throw UOE 2021-12-16 21:07:12 +03:00
Victor Petukhov e50e055eb4 [FE 1.0] Don't try to compute value parameters for variables while creating a flat signature for the overload resolution
^KT-50172 Fixed
2021-12-16 17:46:01 +03:00
Dmitry Petrov ab9747ed6d JVM_IR KT-50277 skip temporary var elimination on inline suspend lambda 2021-12-16 06:40:22 +00:00
Victor Petukhov b3943f5ab6 [FE 1.0] Process builder inference stub types with different nullability properly
^KT-49887 Fixed
2021-12-15 22:23:18 +03:00
Evgeniy.Zhelenskiy ec2e96f3e4 Regenerate inline class tests as 1 arg value classes 2021-12-15 17:14:22 +00:00
Dmitry Petrov e47871f98b JVM_IR KT-50215 KT-50076 extra test 2021-12-13 20:34:57 +03:00
Ilya Goncharov 6adcbe081e [JS IR] Consider erasing type parameters in return type in js signatures 2021-12-13 16:16:59 +00:00
Dmitry Petrov df460a842b JVM_IR KT-50076 avoid CHECKCAST on moved dispatch receiver parameter 2021-12-13 14:13:34 +00:00
Dmitry Petrov 81c805a754 JVM_IR KT-50171 add missing parent to temporary vals for proxy fun 2021-12-11 15:51:12 +00:00
Evgeniy.Zhelenskiy b1d1f87318 [Tests] Introduce reversible source file preprocessor 2021-12-10 18:19:17 +03:00
Evgeniy.Zhelenskiy cb4ec932d7 [Tests] Introduce replacing source transformer 2021-12-10 18:19:17 +03:00
Evgeniy.Zhelenskiy 2874462e3a [Tests] Introduce transformers functions object 2021-12-10 18:19:16 +03:00
Evgeniy.Zhelenskiy af73034235 [Tests] Introduce runTest with transformer to old testing framework 2021-12-10 18:19:16 +03:00
Evgeniy.Zhelenskiy e62c6e3eac [Tests] All tests correct generation 2021-12-10 18:19:16 +03:00
Dmitry Petrov 3017397960 JVM_IR fix string concatenation performance issues
KT-50080 KT-50084 KT-50140
2021-12-09 15:32:13 +03:00
Mikhael Bogdanov 29afd674d2 JvmDefaultWithoutCompatibility. Add test with Kotlin Java mixed inheritance 2021-12-08 12:25:02 +01:00
Dmitry Petrov 93713a9ad4 JVM_IR KT-47939 use FunInterfaceConstructorReference as base class 2021-12-08 14:12:41 +03:00
Dmitry Petrov 0ccd7a7e0c KT-47939 fun interface constructor reference should throw NPE for null 2021-12-08 14:12:41 +03:00
Dmitry Petrov e179598457 JVM_IR KT-47939 equality for fun interface constructor references 2021-12-08 14:12:38 +03:00