Commit Graph

2234 Commits

Author SHA1 Message Date
Mark Punzalan f444702cf3 JVM: Always invoke get()/charAt() in optimized for-loop over
CharSequence.withIndex(), even if element variable is unused in
destructuring declaration.

#KT-34779 Fixed
2019-11-08 10:55:09 +03:00
Alexander Udalov 1978db9d0e Move codegen tests on old language versions under oldLanguageVersions/
This directory is skipped in JVM IR test generator, so they won't show
up as failed anymore.

Note that only failing tests are moved to oldLanguageVersions/. Tests
which already pass are still being run. It may be useful not to break
them in case we _do_ need to support some pre-1.3 language feature
switches in JVM IR.
2019-11-07 19:05:24 +01:00
Alexander Udalov c3729c8189 Reorganize codegen tests for old language versions
Put all files under a single "oldLanguageVersions" directory under test
data of each test
2019-11-07 18:49:27 +01:00
Alexander Udalov 4164b620e8 Minor, remove obsolete directives and suppressions from contracts test data 2019-11-07 15:20:34 +01:00
Alexander Udalov 66e19b13ce IR: create shared variables for val-variables when needed
This is possible when a lambda's contract guarantees initialization of a
variable.
2019-11-07 15:20:34 +01:00
Mark Punzalan d0c261c779 Ensure the correct functions (with correct params) are being used in
ForLoopsLowering.
2019-11-07 13:43:24 +01:00
Mark Punzalan 21178a4f1a Fix issue getting the size property from Collection bounded type
parameters, when lowering for-loops over Collection.indices.
2019-11-07 13:43:24 +01:00
Alexander Udalov 7a2c467bb5 JVM IR: remove obsolete hack in JvmMultifileClass facade generation 2019-11-06 17:05:49 +01:00
victor.petukhov 62d204f4d6 Support trailing comma
^KT-34743 Fixed
2019-11-01 19:40:20 +03:00
Ilmir Usmanov 8c079706a5 Add tests for case when result of tail-call suspend function returning
Unit is not Unit.
 #KT-34703 Fixed
2019-11-01 17:48:06 +03:00
Roman Artemev 78b29349c9 Fix lateinit isInitialized check in multi-file case 2019-10-31 14:45:15 +03:00
Mikhail Zarechenskiy ca8da22569 [NI] Improve CST algorithm to handle non-fixed variables
#KT-32456 Fixed
 #KT-32423 Fixed
 #KT-32818 Fixed
 #KT-33197 Fixed
2019-10-31 11:32:00 +03:00
Dmitry Petrov 2ff36c808e Minor: mute testEa35963 in WASM 2019-10-31 11:13:45 +03:00
pyos a835f07d51 JVM_IR: don't regenerate objects in lambdas inlined into objects 2019-10-31 09:09:54 +01:00
Kristoffer Andersen 1074a0ef69 JVM_IR: Fix Inline CallableReferences with Varargs
- Added tests to demonstrate broken behaviour: the interaction of inline
  functions and callable references with varargs and defaults in various
  combinations.
- Refactored InlineCallableReferencesToLambdaPhase to look like and use
  some of the infrastructure from CallableReferenceLowering.
- Lifted some of this infrastructure out to be broadly reusable.
2019-10-31 08:15:22 +01:00
Mads Ager 1713625718 JVM: Improve line number handling for suspend calls.
Take branching and method calls into account when finding the line
number of the continuation. If there is no line number before
branching instructions or method calls, the following code is
still on the line of the suspend call itself.

This fixes a couple of issues with incorrect line numbers for
multiple throws on the same line or multipe suspend calls on
the same line.

In addition, it avoids the need to spam the method node with
repeated line number instructions in the IR backend.
2019-10-30 13:40:21 +03:00
Alexander Udalov 896512f7cd Support KClass.isInstance/cast/safeCast in stdlib-only reflection implementation
#KT-14720 Fixed
2019-10-29 15:52:00 +01:00
Alexander Udalov 5c89f2fa54 Support KClass.qualifiedName in stdlib-only reflection implementation
#KT-34586 Fixed
2019-10-29 15:51:25 +01:00
Alexander Udalov c164745301 Support KClass.simpleName in stdlib-only reflection implementation
#KT-33646 Fixed
2019-10-29 15:51:21 +01:00
Mark Punzalan b4d2eae12d Add test data generator for stepped progression box tests. 2019-10-28 15:26:38 +01:00
Mark Punzalan 1738c2d4f6 Invoke GenerateInRangeExpressionTestData and
GeneratePrimitiveVsObjectEqualityTestData during
:compiler:generateTests.
2019-10-28 15:26:38 +01:00
Mark Punzalan 277cb39e3b Add new tests for step progressions and fix existing tests. 2019-10-28 15:26:38 +01:00
Igor Chevdar f413da3e58 Turned off test for native
It fixes current JVM BE behavior but seems like this should've been a FE error.
2019-10-28 12:38:19 +03:00
Georgy Bronnikov b63f9176a3 JVM_IR: repair overriddenSymbols in InterfaceDelegationLowering
When creating delegation redirectors for default implementations of
interface functions, `overriddenSymbols` should be repaired across the
whole module, not just a particular file.
2019-10-28 12:12:32 +03:00
Mads Ager 88dd8f663c JVM_IR: Do not generate null checks for suspend function views.
The arguments are null whenever the suspend function is resumed
and takes its state from the continuation parameter.
2019-10-27 07:37:15 +03:00
Alexander Udalov dac0fc7397 Remove obsolete assertion in ExpressionCodegen
With the mangling added in 488418d960, there's no longer any risk in
writing "special" function name ("<anonymous>" in this case) to the
local variable table.

 #KT-34356 Fixed
2019-10-25 19:31:20 +02:00
Mads Ager 52febbcc07 [JVM_IR] Support default interface suspend functions.
Do this by reordering the lowerings so that the lowering that
adds continuations happen after default methods have been
eliminated if needed.

Mark more functions as known to be tail-calls: bridges and
delegated members.

Preserve source info and annotations when creating replacement
functions.
2019-10-24 18:51:41 +03:00
Kristoffer Andersen 8af3b3e51e [Backend] Reorganize version 1.0 codegen tests
- Extract all backend codegen tests that specifically target behaviour
  in to-be-deprecated functionality from language versions < 1.3"
- Remove those tests from the JVM IR test suite.
2019-10-24 16:51:19 +02:00
Alexander Udalov 95be7171bc JVM IR: fix "null" as the first entry in MappedEnumWhenLowering
If "null" was the first entry in an optimizable "when" over enum,
mapRuntimeEnumEntry was called before mapConstEnumEntry, and the
$WhenMappings field was not created. Now both mapConstEnumEntry and
mapRuntimeEnumEntry create this field on the first access
2019-10-23 11:03:22 +02:00
pyos 8c6916af52 JVM_IR inliner fixes: remove code that does nothing
other than randomly throw assertion errors on inline calls in synthetic
functions, which have no line number attached.

`lazySourceMapper.callSiteMarker` is set in `InlineCodegen.inlineCall`;
`IrSourceCompilerForInline.doCreateMethodNodeFromSource` does not need
to touch it.
2019-10-22 19:29:42 +03:00
Mads Ager 8b97819c04 [JVM_IR] Support suspend functions that can be overriden.
The challenge for overridable suspend functions is that the calling
the state machine method to resume after suspension would be
virtually dispatced to the wrong method. To avoid that a static
suspend implementation method is generated which becomes the
state machine method used to resume.
2019-10-22 12:48:21 +03:00
Dmitry Petrov 7dde503697 KT-34500 Use correct loop parameter type in ForInArrayLoopGenerator 2019-10-22 12:23:59 +03:00
Roman Artemev 2cde7f2402 [KLIB] Fix explicitlyExported mode
- Refactor deserialization pipeline
 - Fix K/N test
2019-10-21 17:41:56 +03:00
Roman Artemev 43e855150c [KLIB] Correctly restore top level property order during deserialization - Add test - Fix KT-34273 2019-10-21 17:41:56 +03:00
Denis Zharkov d902a5f304 Temporary disable assertion in bridges generation
^KT-34431 Fixed
^KT-34507 Open
2019-10-21 17:24:15 +03:00
Mads Ager 4b77db8979 Fix test to actually fail if expected exception is not thrown. 2019-10-21 15:05:32 +02:00
pyos 0c3dfca6ee JVM_IR: remove an assertion that triggers due to a frontend bug 2019-10-21 14:59:03 +02:00
Mads Ager 8be6a1fe8a [JVM_IR] Contain 'invokeSuspend' rewriting to the suspend function.
Do not rewrite returns in methods in nested lambda implementations.
That leads to unintended non-local returns from nested non-suspend
lambdas.
2019-10-21 13:16:57 +03:00
Ilmir Usmanov 78b9c082e7 JVM_IR: Generate 'create' for suspend lambdas with one parameter 2019-10-21 13:15:45 +03:00
Ilmir Usmanov 5eeb2958f7 JVM_IR: Support is/as SuspendFunction operators 2019-10-21 13:15:43 +03:00
Ilmir Usmanov 6f47699796 JVM_IR: Calculate correct arity of callable reference to suspend
function
2019-10-21 13:15:41 +03:00
Ilmir Usmanov b0a0399dd0 JVM_IR: Support callable references to suspend functions 2019-10-21 13:15:39 +03:00
Ilmir Usmanov e736b782dd JVM_IR: Support suspend lambdas with multiple parameters 2019-10-21 13:15:37 +03:00
Ilmir Usmanov f4a7c839d3 JVM_IR: Generate as much LINENUMBER information as possible inside
suspend functions and lambdas.

Otherwise, when state-machine builder splits instructions and adds
LINENUMBER between states, the information becomes corrupted.
2019-10-21 13:15:35 +03:00
Steven Schäfer eb744cc9e1 JVM IR: Fix constant folding for unsigned toString 2019-10-18 17:24:53 +02:00
Steven Schäfer 64aa50a921 Add more tests for SAM wrappers 2019-10-18 17:22:58 +02:00
Steven Schäfer 3098723406 Minor: Fix outdated test 2019-10-18 17:20:22 +02:00
Steven Schäfer 9389d88232 JVM IR: Hide constructors with inline class parameters 2019-10-18 17:20:22 +02:00
Mikhael Bogdanov c78dbaf6b3 Initializer default values in 'tailrec' method in proper order
#KT-31540 Fixed
2019-10-17 13:06:36 +02:00
pyos 27094d0371 JVM_IR: fix synthetic accessor generation (again)
Turns out private inline functions *can* be called from other classes.
2019-10-17 12:38:19 +02:00