Commit Graph

2973 Commits

Author SHA1 Message Date
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 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 cef81e11b7 Do not generate JS tests for experimental coroutines support
#KT-36083
2020-01-29 09:12:40 +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
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
Alexander Udalov 5321a6af33 Forbid spread operator in signature-polymorphic calls
#KT-35226 Fixed
2020-01-21 15:57:35 +01:00
Georgy Bronnikov 1c527fc159 IR: avoid name clashes between raised local functions. 2020-01-21 12:50:55 +03: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
Ilmir Usmanov 1ef5e25c60 JVM_IR: Minor. Update test data 2020-01-20 18:59:00 +01:00
Ilmir Usmanov 56c8fdc6c4 JVM_IR: Perform tail-call optimization on IR
It is easier to introduce a new lowering so the codegen will emit code for the old
tail-call optimizer to understand. Also, this is more flexible and would allow to
optimize cases, which are now feasible with the old optimizer.
Note, that because of bytecode inlining, we cannot replace the old one, but we cannot
emit code, that is simpler for it to optimize.
2020-01-20 16:00:35 +01:00
Ilmir Usmanov 9f5b51ed43 JVM_IR: Do not generate fake continuation markers inside inline suspend lambdas
Since the markers replace ALOAD 0 as continuations, passed to suspend calls, in
JVM_IR we do not need this, since in JVM_IR all inline lambdas are static
functions.
2020-01-20 16:00:35 +01: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
Ilmir Usmanov d17afddaa9 JVM_IR: Fix bridges generation for suspend functions
Use view's signature as jvm signature.
2020-01-20 16:00:34 +01:00
Ilmir Usmanov 7167d5f75c JVM_IR: Generate $$forInline companion for transformed crossroutines 2020-01-20 16:00:33 +01:00
Ilmir Usmanov 64c1446fbe JVM_IR: Generate $$forInline companion for suspend inline functions
Set isInline flag for $$forInline functions. Otherwise, SMAP will not be generated
for inner objects/lambdas, leading to error in inliner.
2020-01-20 16:00:32 +01:00
Ilmir Usmanov 4ef2ecf9a9 JVM_IR: Add returns unit marker if suspend call returns unit 2020-01-20 16:00:32 +01:00
Mikhail Zarechenskiy 5c5635ce20 Fix codegen & bytecode tests after unifying exceptions in JVM backend
See KT-22275 for details
2020-01-20 16:36:03 +03: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
Mads Ager 33a24bfd27 JVM_IR: Avoid using parent name in name of captures.
If parent is an anonymous object that could lead to the use
of names such as `$this$no name provided` which is invalid
in dex files.
2020-01-20 10:49:46 +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 58c235e722 Set up tests for fun interfaces for JVM backend for now 2020-01-17 19:37:48 +03:00
Mikhail Zarechenskiy 8350cf7d14 FIC: rename FunctionConversion -> FunctionalConversion 2020-01-17 19:37:47 +03:00
Mikhail Zarechenskiy 70094884ca FIC: support suspend conversions in jvm codegen 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 b7c43fc7db Refactoring: move test folder out of "inline classes" folder
It was added there by mistake
2020-01-17 19:36:08 +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