Commit Graph

4268 Commits

Author SHA1 Message Date
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
Alexander Udalov 6a90dc2efe Fix bytecode text tests for language version 1.4
New null check assertions are generated a bit more efficiently, with a
call to `checkNotNull` instead of IFNONNULL+jump.
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 6ede10c1ca JVM_IR: Minor. Add test for SMAP of inner object/lambda of inline suspend function 2020-01-20 16:00:36 +01:00
Ilmir Usmanov 877509306d JVM_IR: Minor. Unmute tests. 2020-01-20 16:00:36 +01:00
Ilmir Usmanov 891a55d79a JVM_IR: Fix visibility of inner suspend lambda inside inline function
It should be public, otherwise, after inlining, we will get IllegalAccessError.
2020-01-20 16:00:36 +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 2507e2b526 JVM_IR: Fix parents of $$forInline companions 2020-01-20 16:00:33 +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
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 f8341ad7eb JVM: Update tests for IEEE 754 comparisons 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
Alexander Udalov 26f435eb90 JVM IR: mute tests which fail after advancing language to 1.4 2020-01-17 12:07:30 +01:00
Alexander Udalov e7864c7351 Fix inlineCallsStaticMethodFromOtherPackage.kt by disabling related language feature
This test is not possible for 1.4, where protected calls from public
inline functions are prohibited.
2020-01-17 12:07:30 +01:00
Dmitriy Novozhilov 76b3964e96 Update testdata according to change compiler version to 1.4 2020-01-17 10:33:50 +03:00
pyos 6e6f4d0503 IR: close over the set of captured type parameters 2020-01-16 16:37:40 +03:00
Ilya Gorbunov 9566f329f0 Mute FIR test failures and adjust failing test data due to KT-35948 2020-01-16 15:36:19 +03:00
Ilya Gorbunov 0f6df5971b Mute tests failing in JS_IR backend due to KT-35944 2020-01-16 15:36:16 +03:00
Ilya Gorbunov ac790bea71 Reorganize diagnostics tests with stdlib and reflect
DiagnosticsTestWithStdLib now require stdlib only.
Move test data accordingly.
The only test that required kotlin-reflect is transformed into
codegen box test.
2020-01-16 15:35:58 +03:00
Alexander Udalov 621936e951 Do not generate Throws attribute for delegated members from Kotlin interfaces
#KT-31763 Fixed
 #KT-35834
2020-01-16 12:43:09 +01:00
Dmitriy Novozhilov 5111d1721a [TEST] Add js runtime to failing box test 2020-01-15 22:12:29 +03:00
Dmitriy Novozhilov 04ce10b6c1 [NI] Improve completing callable references with type variable as expected type
#KT-32462 Fixed
2020-01-15 22:12:28 +03:00
Alexander Udalov 6fe214d825 JVM IR: fix handling of suspend extension lambdas with captured receiver
The problem in the added test was that a suspend lambda was represented
by a function reference with a bound argument for the ObjectRef value,
and the corresponding parameter was not the first parameter of the
referenced local function. This happens because
LocalDeclarationsLowering lifts the local function up and adds a
new parameter for the captured ObjectRef (which is bound at the call
site), but the original receiver parameter remains the first unbound
parameter. So, it's no longer correct to rely on the fact that all bound
parameters of a function reference are located in the beginning of the
parameter list, which was kind of assumed in the `withIndex` call in
`AddContinuationLowering.addCreate`.
2020-01-15 19:42:13 +01:00
Dmitry Petrov 6bbfb2ffe9 JVM: add tests for companion object accessor generation 2020-01-15 16:40:06 +03:00
Dmitriy Novozhilov 3428a17759 [NI] Postpone calls with not enough information in builder inference 2020-01-15 14:01:25 +03:00
Alexander Udalov 7742a3b697 Rename UseExperimental->OptIn, Experimental->RequiresOptIn in compiler tests 2020-01-14 21:04:42 +01:00
Mads Ager ca05ff1791 JVM_IR: Fix bug in suspend function with many default arguments. 2020-01-14 20:48:44 +01:00
pyos f73891af98 JVM_IR: actually forward the parameters to $suspendImpl 2020-01-14 20:46:48 +01:00
pyos 99eab5a058 IR: unify 3 copies of function body remapping
Also,

  1. remove some redundant copies;

  2. fix remapping of non-local returns in lambdas if the body is moved
     after LocalDeclarationsLowering (the lambda is no longer inside the
     body, but must still be visited)
2020-01-14 18:48:27 +03:00
Svyatoslav Kuzmich 1333267983 [JS IR] Add serialization regressions tests 2020-01-14 18:00:29 +03:00
Dmitriy Novozhilov 02d9f258d1 [FIR-TEST] Mute failing blackbox test 2020-01-14 17:34:21 +03:00