Commit Graph

1041 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
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 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 c03573fc18 JVM_IR fix override equivalence check for collection stub generation
KT-42043 KT-42033
2020-09-22 15:26:34 +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 9ecf5dc9af Support is/as operations on suspend callable reference conversion 2020-09-17 16:14:04 +02: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
Dmitry Petrov 54d5494ecd JVM_IR special handling for 'remove' collection method stub 2020-09-16 15:36:16 +03:00
Pavel Kirpichenkov b102042dd8 Minor: add regression test for KT-41806 2020-09-15 10:52:47 +03: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
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
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
Victor Petukhov c1ebd33833 Capture flexible intersection types properly: take into account both bounds and use the same captured arguments for them
^KT-41693 Fixed
2020-09-09 14:52:12 +03:00
Alexander Udalov 3a5d0ab427 JVM IR: fix HashCode intrinsic for generics substituted with primitives
The problem here was that although the IR type of the expression was
primitive, the type of the actual expression in the bytecode generated
after type erasure was `Ljava/lang/Object;`, and we were trying to call
a non-existing method `Object.hashCode(Object)`.

 #KT-41669 Fixed
2020-09-08 23:37:00 +02:00
Steven Schäfer 44ffb1fb3e Psi2Ir: Fix SAM conversion with new inference 2020-09-08 11:14:14 +03:00
Dmitry Petrov b00ce872ea JVM: record JVM signature for equals/hashCode/toString in inline classes 2020-09-07 12:25:50 +03:00
Victor Petukhov 85d99612a2 Don't create inconsistent types (with contradictive use site and declaration site variances) for star projections with corresponding contravariant type parameters during substitution
^KT-41388 Fixed
2020-09-03 16:24:28 +03:00
Alexander Udalov 5aca8ebda8 Minor, add test case on metadata of lambdas in constructors
KT-41465
2020-09-02 20:04:05 +02:00
pyos 6b65a2ea7d JVM_IR: move classes out of lambdas inlined into initializers
Fixes KT-41465
2020-09-02 20:03:38 +02:00
Pavel Kirpichenkov 2979c37001 [NI] Fix resolution status for UnstableSmartCastDiagnostic
RESOLVED_WITH_ERROR was initially added for reproducing OI behavior.
The intention was to preserve resolution into unstable smart cast and to keep failing candidate.
However, this idea was abandoned after OI behavior proved inconsistent in cases involving generics.

This commit restores RUNTIME_ERROR status of UnstableSmartCastDiagnostic.

^KT-41357 Fixed
2020-09-01 11:21:13 +03:00
Steven Schäfer b02f0f0a25 JVM IR: Fix compilation of nested inner classes 2020-08-28 20:03:19 +02:00
Mikhail Zarechenskiy 23f87d413a Use initial system for completion if common one is effectively empty
Otherwise we can get unsubstituted type variables as expected types and
 then write wrong information for assertions

 #KT-41470 Fixed
2020-08-28 17:47:08 +03:00
Alexander Udalov 74c6d2b951 Do not generate non-standard compareTo as primitive comparison in all backends
Previous changes related to this in the old JVM backend were in
582b1c5e66 and
0482f7e9c5, but they did not affect the
`ProperIeee754Comparisons` mode which became the default in 1.4.0. As a
result, we had a regression here.

Since the `PRIMITIVE_NUMERIC_COMPARISON_INFO` slice is used in psi2ir to
determine how to generate the comparison, this fixes the regression both
in the old JVM backend, and in all IR backends.

 #KT-41426 Fixed
2020-08-27 19:00:11 +02:00
Dmitriy Novozhilov 9cde42e2bc [NI] Fix shouldRunCompletion for builder inference session
#KT-41308 Fixed
#KT-41363
2020-08-27 16:51:12 +03:00
Dmitriy Novozhilov e98cbf81cf [NI] Don't always complete builder inference lambda in FULL mode
#KT-41164 Fixed
2020-08-27 16:51:11 +03:00
Mikhail Zarechenskiy cba13c3c35 Take into account captured types with variables during fixation
#KT-41202 Fixed
2020-08-27 11:06:14 +03:00
Mikhail Zarechenskiy 06a592c018 Fix SOE when recursive type argument is used with star projection
#KT-41043 Fixed
2020-08-26 19:23:21 +03:00
Mikhail Zarechenskiy 674e9e455f Fold lower constraints like (T!!..T) and (T..T?) into the latter one
#KT-41149 Fixed
2020-08-26 19:23:20 +03:00
Mikhail Zarechenskiy 567e6ca9ca Fix OOM when there are several lambdas with extension function types
#KT-41335 Fixed
2020-08-26 19:23:18 +03:00
Steven Schäfer ea98062241 JVM IR: Fix compilation of inline functions in anonymous objects...
...in class members. The corresponding classes end up nested in the
class initializer of the surrounding class and we need to take this into
account when creating instances of ClassCodegen.

This fixes KT-40332 on the JVM IR backend.
2020-08-24 14:10:36 +02:00
Mark Punzalan 1c1b1b4b0f Initial version of RangeContainsLowering, which optimizes calls to
contains() on ClosedRanges.
2020-08-21 21:15:27 +02:00
Mikhail Zarechenskiy ced151f3af Add test for KT-41254
It was fixed along with #KT-41005
2020-08-20 15:45:32 +03:00
Mikhail Zarechenskiy 6ed13ef1b6 Fix unresolved reference to catch parameter from lambda expression
#KT-41140 Fixed
2020-08-19 12:52:16 +03:00
Mikhail Zarechenskiy f2fba8a469 Fix delegated property resolve when provideDelegate has this as argument
#KT-41135 Fixed
2020-08-19 12:52:16 +03:00
Igor Chevdar e468a347b5 [box-tests] Tests on field init optimization
Added tests on all primitive types and a test when the field's type is an inline class
2020-08-15 12:16:33 +05:00
Steven Schäfer 0328fcaf5d JVM IR: Avoid IMPLICIT_NOTNULL checks on special bridge methods
...with dynamic type checks, except for the `@PlatformDependent`
methods, for which the JVM backend adds null checks.
2020-08-14 21:59:33 +02:00
Steven Schäfer 9026f89ba5 JVM IR: Avoid CHECKCASTs on type operators (KT-39520)
The type information coming from Java or Kotlin generics may be wrong
due to type erasure and a CHECKCAST instruction could throw an
exception.
2020-08-14 21:58:47 +02:00
Mikhail Zarechenskiy aafe41cf7a Do not force coercion to Unit for nullable lambda return type
#KT-41005 Fixed
2020-08-13 10:40:51 +03:00
Ilmir Usmanov 00bf07fc41 Force boxing kotlin.Result return type of suspend functions
#KT-40843 Fixed
2020-08-11 22:10:47 +02:00
Ilmir Usmanov d861373c6d Hack attributes for continuation of suspend function in SAM-adapter 2020-08-11 11:58:20 +02:00
Mikhail Zarechenskiy 2e131b870a Add tests for obsolete issues
#KT-38804 Obsolete
 #KT-38801 Obsolete
 #KT-38835 Obsolete
 #KT-38737 Obsolete
 #KT-38664 Obsolete
 #KT-38549 Obsolete
 #KT-38766 Obsolete
 #KT-38714 Obsolete
2020-08-11 12:34:02 +03:00
Mikhael Bogdanov 607f99ed3c Don't generate implicit overrides delegating to Java defaults
#KT-40920 Fixed
2020-08-10 20:03:23 +02:00
Georgy Bronnikov ea57b4cccb IR: add and unmute tests 2020-08-10 10:16:24 +03:00