Commit Graph

8267 Commits

Author SHA1 Message Date
Mikhael Bogdanov 9e26491631 Beatify names for enum name and ordinal local variables 2020-01-31 11:39:54 +01:00
Mikhael Bogdanov cd0c45c832 JVM_IR. Generate proper suffix for companion backing field accessor and parameter name 2020-01-31 11:39:53 +01:00
Mark Punzalan 3ee344b836 ForLoopsLowering: Fix issue with break/continue in loop over withIndex. 2020-01-31 10:37:03 +01:00
Alexander Udalov 9f25fdcedc Minor, skip mustBeDocumented.kt for JDK 6 codegen tests
Class.getDeclaredAnnotation is not available before JDK 8
2020-01-31 09:36:17 +01:00
Mads Ager e8a640851a FIR: Change the Fir2Ir handling of smart casts.
Generate the expression with the original type and then insert
an implicit conversion. That matches the behavior of psi2ir
better and therefore avoids breaking backend assumptions.

In particular, IrGetValue expects the type of the underlying
symbol and the type of the IrGetValue to be the same.
2020-01-31 09:31:52 +01:00
Mads Ager d68a1898d0 JVM_IR: Use direct field access instead of calling certain accessors.
Final default properties accessors that access a backing field
on the same class can be replaced by direct field use.

Perform the optimization late in the pipeline to allow lowerings
to expose more opportunities for optimizations.
2020-01-31 09:31:52 +01:00
Denis Zharkov 47ecaa5b06 FIR: Fix scope intersection types
Otherwise overload resolution ambiguity is reported in the test
2020-01-30 17:12:50 +03:00
Mikhail Glukhikh 2bb5740f47 [FIR] Resolve ambiguities in Java static scopes 2020-01-30 16:28:08 +03:00
Steven Schäfer cf3e4608f3 JVM IR: Support -Xno-call-assertions 2020-01-30 14:43:23 +03:00
Kristoffer Andersen 61e6d346aa [JVM IR] Interface Delegation by Property should use existing field
When a property backed by a final field is the delegate for interface
implementation by delegation, the backend should reuse the backing
field rather than introduce a new, extraneous `$$delegate_n` field.
2020-01-30 14:42:24 +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
Mads Ager 73aa36ca59 JVM: Add D8 check that class files can be dexed with D8.
This change adds D8 in addition to Dx which is being deprecated.
At some point after the official Dx deprecation, we should remove
the Dx checker.

Moving to D8 has the additional benefit that D8 can dex code
using java 8 features without using a separate desugaring tool.
2020-01-29 18:00:45 +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
Mikhael Bogdanov f5f25224b0 JVM_IR. Add IrAsmLikeInstructionListingTestGenerated tests 2020-01-29 17:00:00 +01:00
Mikhael Bogdanov 342ff50e31 Minor. Update test 2020-01-29 16:59:59 +01:00
Mikhael Bogdanov 504d79577d JVM_IR. Align outer parameter name generation between backends 2020-01-29 16:59:57 +01:00
Mikhael Bogdanov 17e89fbbdb JVM_IR. Align synthetic parameter name generation across backends 2020-01-29 16:59:57 +01:00
Mikhael Bogdanov c42984ca33 Generate proper flags for <clinit> 2020-01-29 16:59:56 +01:00
Mikhael Bogdanov 6c07dbf351 JVM_IR. Support type annotations 2020-01-29 16:59:55 +01:00
Mikhail Zarechenskiy ce690d8a1d Add test for obsolete issue
#KT-36121 Obsolete
2020-01-29 11:43:11 +03:00
Ilya Gorbunov c28710419a Drop noStdLib coroutines tests
They were disabled anyway because coroutines can't be compiled without
the support API in stdlib

#KT-36083
2020-01-29 09:12:42 +03:00
Ilya Gorbunov 9f8e3dad33 Add coroutines-compat jar dependency to those tests that require it
#KT-36083
2020-01-29 09:12:40 +03:00
Ilya Gorbunov cef81e11b7 Do not generate JS tests for experimental coroutines support
#KT-36083
2020-01-29 09:12:40 +03:00
max-kammerer f256547cc8 Revert "JVM_IR: Use direct field access instead of calling certain accessors."
This reverts commit 62f9e7a810.
2020-01-28 14:55:56 +01:00
Mads Ager 62f9e7a810 JVM_IR: Use direct field access instead of calling certain accessors.
Final default properties accessors that access a backing field
on the same class can be replaced by direct field use.

Perform the optimization late in the pipeline to allow lowerings
to expose more opportunities for optimizations.
2020-01-28 10:42:15 +01:00
Georgy Bronnikov 8f4b4007fe JVM_IR: Add test for compiling against cross-platform Klib 2020-01-28 12:19:43 +03:00
Mads Ager e327b174a2 IR: Use name \$\$delegate_n for the field for interface delegation.
Without this change, these fields could have names such as
`<no name provided>$SuperClass$delegate` for something like
`object SuperClass by I { }`.
2020-01-27 15:28:27 +03:00
Mikhail Glukhikh f949b48b4a [FIR] Swap priority of kotlin libraries / built-ins #KT-35948 Fixed 2020-01-27 13:21:54 +03:00
Mikhail Glukhikh ef8485a232 FIR2IR: change receiver handling in case it's an outer object
Before this commit, FIR2IR expected that FIR will have no receiver
in this case. However, now FIR *has* receiver, so we have to convert
it to object correctly
2020-01-27 00:34:16 +03:00
Dmitriy Novozhilov 20ac606df4 Add js runtime to failing blackbox test 2020-01-24 14:17:44 +03:00
Alexander Udalov 2fca7f1a54 Add codegen tests for old behavior of null checks
#KT-22275
2020-01-24 11:56:28 +01:00
Mark Punzalan 7329a1641a [JVM IR] Fix lambdaInLocalFunction.kt by adding helper methods that
return the target backend under test.
2020-01-23 19:16:27 +01: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
Mikhail Glukhikh 69ecbd93a9 [FIR] Fix type alias handling in qualifier position 2020-01-23 12:32:39 +03:00
Steven Schäfer aea5e3ffbc JVM IR: Remove type substitutions from ExpressionCodegen
Instead, determine whether the return type of a call is Nothing, by
looking at the type of the call expression.
2020-01-22 15:51:11 +01:00
pyos 2f0f4e570f JVM_IR: do not remap locals in contexts nested inside lambdas
The only case where this code is reachable at all is objects in lambdas
that use reified type parameters of the outer inline function. Since the
type parameters are declared outside the inlining root, regenerating the
object is actually pointless, and remapping its captures even more so
(not to mention that the code under the condition uses the captures of
the lambda, not of the method it's currently transforming).
2020-01-22 15:36:09 +01:00
Alexander Udalov 3ca0f8a569 Fix incorrect message for new nullability assertion exception in 1.4
#KT-36026 Fixed
2020-01-22 14:41:20 +01: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
Dmitriy Novozhilov 72cb0de705 [FIR-TEST] Update testdata 2020-01-22 14:49:23 +03:00
Dmitry Petrov 64a405e7a0 IR: 'fun interface' support 2020-01-22 00:12:03 +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
Steven Schäfer 8e07482862 JVM IR: Fix generation of parameterless default constructor
The JVM backend does not generate parameterless default constructors for
private constructors and constructors of local, inner, or inline
classes.
2020-01-21 16:34:33 +01:00
Alexander Udalov 5321a6af33 Forbid spread operator in signature-polymorphic calls
#KT-35226 Fixed
2020-01-21 15:57:35 +01:00
Alexander Udalov 99294cfdae Minor, fix test data
TypeCastException was unresolved after an accidental change in
f48bdc1fcb.
2020-01-21 11:26:21 +01:00
Mads Ager 79840a05b2 Fix test expectations.
Do not check for occurrences of "this" on the current backend.
I accidentally unified the checking for the two backends
without checking that it worked (used the wrong test suite to
test).
2020-01-21 11:26:02 +01:00
Georgy Bronnikov 1c527fc159 IR: avoid name clashes between raised local functions. 2020-01-21 12:50:55 +03:00
Alexander Udalov c0600e6873 JVM IR: minor, mute and adapt noCallAssertions.kt to 1.4 2020-01-20 19:12:59 +01:00
Alexander Udalov 078b934580 Mute/unmute JVM backend tests for language version 1.4 2020-01-20 19:12:59 +01:00
Alexander Udalov f48bdc1fcb Fix codegen box tests for language version 1.4
Since API version 1.4, NullPointerException is thrown for casts of null
to any type instead of TypeCastException.
2020-01-20 19:12:59 +01:00