Commit Graph

811 Commits

Author SHA1 Message Date
Roman Artemev 5004bb3636 [Psi2Ir] Fix generation of hashcode for generic inline class 2020-02-14 18:22:16 +03:00
Georgy Bronnikov 79060e7f40 IR: handle conflicts in resolveFakeOverride() 2020-02-14 17:20:34 +03:00
Georgy Bronnikov c71e87068a JVM_IR: in InheritedDefaultMethodsOnClassesLowering, skip bridges when resolving overrides 2020-02-14 17:20:34 +03:00
Alexander Udalov 3278451b07 JVM IR: do not generate certain special bridges as final
Special bridges which are generated as a replacement for a non-final
fake override and use invokespecial to call the already existing
implementation in the superclass, should not be final. Otherwise we
can't generate an override for the original Kotlin function in a
subclass with the same JVM signature.
2020-02-13 14:34:18 +01:00
Mark Punzalan ba606147c9 [JVM IR] Maintain KT-36625 bug compatibility between non-IR and IR
backends by removing IMPLICIT_NOTNULL casts from IrStringConcatenation
arguments.

Also fixed an issue where IrStringConcatenation can be lowered into
a null String instead of a literal "null" String if the lone argument
was a platform type String or String with enhanced nullability and the
value was null (e.g., "${FromJava.nullPlatformString()}").
2020-02-12 22:57:15 +03:00
Alexander Udalov d5987fd7f3 Minor, move wrongAnnotationArgumentInCtor.kt to CLI tests
The fact that this was a codegen box test was probably an abuse of the
testing infrastructure. It was never meant to pass, since it checks
presence of an error, and diagnostic tests aren't enough since they
might not check the full compiler execution.
2020-02-12 17:36:08 +01:00
Alexander Udalov 0df455cb52 Minor, remove duplicate test
There's already a test that checks exactly this behavior at
box/oldLanguageVersions/platformTypes/primitives/equalsNull_lv11.kt.
2020-02-12 17:36:08 +01:00
Mikhail Zarechenskiy c58e819a6a Regenerate tests 2020-02-12 10:36:46 +03:00
Mikhail Zarechenskiy 1acce46133 [NI] Fix recording info about captured local variables 2020-02-12 10:36:43 +03:00
Georgy Bronnikov 17e1f081c7 JVM_IR: handle nested function references in InlineCallableReferenceToLambda 2020-02-10 18:47:04 +03:00
Alexander Udalov 15ff74209c JVM IR: do not resolve fake override in InterfaceSuperCallsLowering
This leads to problems after 4dd794c2d2, because the immediate super
function's DefaultImpls and the implementation's DefaultImpls have
differing type parameters.

Looks like resolveFakeOverride was used here (maybe unintentionally) as
a workaround to the problem caused by the incorrect origin check in
isDefinitelyNotDefaultImplsMethod.
2020-02-10 16:08:10 +01:00
Georgy Bronnikov 182e1c1b3b JVM_IR: Remove buggy special case accessor code from JvmStaticAnnotationLowering
General purpose accessors in SyntheticAnnotationLowering are sufficient.
2020-02-09 13:12:33 +03:00
Steven Schäfer 5f6af58aeb JVM IR: (Un)mute tests and add more tests for bridge generation 2020-02-07 18:44:50 +03:00
Mark Punzalan 8cdef13537 [JVM IR] Add tests to verify correct parameter reflection metadata for
suspend functions.
2020-02-07 12:24:13 +01:00
pyos 06408011f0 JVM_IR: prefer to move, not copy, suspend lambda bodies
Copying breaks reflection metadata.
2020-02-07 12:16:26 +01:00
Anton Bannykh 70a4c265de Add tests extracted from regressions 2020-02-06 21:03:41 +03:00
Alexander Udalov 763cb6dd6f JVM IR: keep original KotlinType in eraseTypeParameters
Otherwise EnhancedNullability annotation instance is lost (for some
reason it's not translated to IR elements), and in the newly added test,
the wrapper type in Java is confused with primitive, and this causes
a platform declaration clash error.

Also make IrTypeArgument.eraseTypeParameters private, since it's not
used outside.
2020-02-05 21:51:33 +01:00
Ilmir Usmanov 8335ad7e98 JVM_IR: Minor. Add test 2020-02-05 15:07:55 +01:00
Alexander Udalov 9f9eef44b1 Use captured type approximation from new inference in ExpressionCodegen
This is needed in order to avoid star projections being expanded into
`out Any?`, which is visible for users of `typeOf` since 1.4.

 #KT-30278 Fixed
2020-02-05 13:09:08 +01:00
Mikhail Zarechenskiy cb07c9172f [NI] Record substituted generic signature for SAM arguments
#KT-36297 Fixed
2020-02-04 10:26:48 +03:00
Mikhail Zarechenskiy 60a2d0f037 [NI] Approximate receivers for callable reference candidates
#KT-36221 Fixed
2020-01-31 18:26:32 +03:00
Mikhail Zarechenskiy 069fbffaa3 Regenerate tests: fix LightAnalysisModeTestGenerated 2020-01-31 15:39:52 +03:00
Mark Punzalan 3ee344b836 ForLoopsLowering: Fix issue with break/continue in loop over withIndex. 2020-01-31 10:37:03 +01:00
Steven Schäfer cf3e4608f3 JVM IR: Support -Xno-call-assertions 2020-01-30 14:43:23 +03:00
Mikhael Bogdanov 10900e0d90 JVM_IR. Don't copy synthetic method for property annotations if @JvmStatic presented 2020-01-30 12:31:38 +01:00
Alexander Udalov 186a456e01 JVM IR: fix condition in Documented annotation generation 2020-01-30 00:06:03 +01:00
Mark Punzalan e226561150 [JVM IR] Copy metadata in IrFieldBuilder.
This fixes an issue with lateinit properties where the metadata from
the original field was not copied to the nullable field in
LateinitLowering. Also consolidated related tests.
2020-01-29 17:12:16 +01:00
Dmitry Petrov bf9673a0a2 PSI2IR: SAM conversion should be performed once for index variables
Given esoteric code as in 'caoWithAdaptationForSam.kt', we should make
sure that we pass same objects to 'get' and 'set'.
2020-01-29 15:30:07 +03:00
Mikhail Zarechenskiy ce690d8a1d Add test for obsolete issue
#KT-36121 Obsolete
2020-01-29 11:43:11 +03:00
Alexander Udalov 2fca7f1a54 Add codegen tests for old behavior of null checks
#KT-22275
2020-01-24 11:56:28 +01:00
Mikhail Zarechenskiy f1d9177112 [NI] Fix issue with returning non-deparenthesized lambdas from labmdas
#KT-36080 Fixed
2020-01-23 18:56:02 +03:00
Dmitriy Novozhilov be74e92c27 [NI] Add missing type variables to common system in builder inference
#KT-35967 Fixed
2020-01-23 14:30:28 +03:00
Pavel Kirpichenkov c5893913f3 [NI] Remove lambda coersion to Unit in case of error return type(s)
Coersion to Unit from error type leads to misleading type mismatches:
"expected <expected lambda return type> found Unit", despite no user-provided Unit / empty lambda.
These diagnostics were collected, but not reported before, and that had been disguising the issue for a while.

KT-34729 Fixed
2020-01-23 13:18:50 +03:00
Zalim Bashorov f92376fbbd [BE test] Extract and mute cases which don't work on JS from eqNullableDoubles.kt and eqNullableDoubles.kt 2020-01-22 15:20:41 +03:00
Ilmir Usmanov a55989a2a5 JVM_IR: Support interface delegation of suspend functions
The issue was, that built IR function does not have a PSI element,
which is required to report error on suspend functions inside monitors.
In this case, use PSI element of the class, containing the function,
which is consistent with old BE.
2020-01-21 19:59:02 +01:00
Georgy Bronnikov 1c527fc159 IR: avoid name clashes between raised local functions. 2020-01-21 12:50:55 +03:00
Ilmir Usmanov 4d9d62ad12 JVM_IR: Also check attributes for suspendImpls when generating continuation
Otherwise, it would not generate continuations for overloads.
2020-01-20 16:00:34 +01:00
Mads Ager 1ed7e33f42 JVM_IR: Fix default argument bit mask for methods made static.
When called by reflection the bit mask will be generated
discounting dispatch/extension receivers. Make sure that the
interpretation of the bit mask is consistent for direct and
reflective calls.

In addition, this also fixes the modifiers on java 8 parameter
metadata for the dispatch and extension receivers for these
inline class methods.
2020-01-20 12:59:25 +01:00
Pavel Kirpichenkov cb0b44273d [NI] Check stub types in result type
An uninferred parameter stub may leak through calculation of CST(Inv<Uninferred Stub>, Nothing) into a result type.
A stub type in the result type means a type error. So we can afford recalculating
CST with stub-containing types filtered out, since its an error anyway.
This prevents stub types leakages and helps with reporting type error diagnostics.

KT-35914 Fixed
KT-35943 Fixed
2020-01-20 11:11:31 +03:00
Mikhail Zarechenskiy 70094884ca FIC: support suspend conversions in jvm codegen 2020-01-17 19:36:11 +03:00
Mikhail Zarechenskiy b98d8bd7c1 Regenerate tests after rebase on master, add FIR tests 2020-01-17 19:36:11 +03:00
Mikhail Zarechenskiy 3849b5e723 FIC: add codegen tests, adapt previously tests for SAMs 2020-01-17 19:36:09 +03:00
Mikhail Zarechenskiy 0ee977c42e FIC: Support base version of conversions in JVM backend
Proper support for JVM backend will be in the further commmits
2020-01-17 19:36:02 +03:00
Mikhail Zarechenskiy 55935cc98a FIC: introduce language feature, modifiers checks and basic tests 2020-01-17 19:36:00 +03:00
Victor Petukhov 437a26684d NI: Prefer nullable lower bound to flexible one when substitution of type variable is performed and remember flexibility of type parameters based on flexibility of its upper bounds
^KT-32435 Fixed
2020-01-17 19:16:09 +03:00
Steven Schäfer a49ed1eca2 JVM IR: Generate interface delegations for specialized interface defaults 2020-01-17 18:19:26 +03:00
Steven Schäfer 8746d08dd5 JVM IR: Don't skip bridge generation for concrete fake overrides 2020-01-17 18:19:26 +03:00
Dmitry Petrov 933ac3a16b Fix nullable number comparisons in JS 2020-01-17 14:14:59 +03:00
Dmitry Petrov d5ff1047a5 JVM: Fix IEEE 754 comparison generation for boxed numbers 2020-01-17 14:14:58 +03:00
pyos 6e6f4d0503 IR: close over the set of captured type parameters 2020-01-16 16:37:40 +03:00