Commit Graph

5668 Commits

Author SHA1 Message Date
Mads Ager 250cc1dc92 [JVM] Never treat arguments to methods as locals that can be removed.
Fixes KT-44347
2021-01-15 10:33:11 +03:00
Alexander Udalov e0363788f4 Remove some remaining tests on old coroutines 2021-01-13 19:16:31 +01:00
Zalim Bashorov 47c4197098 [JS old] Revert fix made for KT-44221 in ab753625
And mute the test for old BE.

#KT-44221 Open
2021-01-13 01:22:17 +03:00
Dmitriy Novozhilov af5a635f85 [Test] Ignore error diagnostics from FIR in some BB tests 2021-01-12 18:35:39 +03:00
Dmitriy Novozhilov 2eeed1281c [Test] Mute failing FIR BB tests related to MPP 2021-01-12 18:35:37 +03:00
Dmitriy Novozhilov e3c7bd5f85 [Test] Migrate AbstractIrBlackBoxCodegenTest to new infrastructure 2021-01-12 18:35:34 +03:00
Dmitriy Novozhilov 85c87f7df9 [Test] Migrate AbstractBlackBoxCodegenTest to new infrastructure 2021-01-12 18:35:30 +03:00
Dmitriy Novozhilov f01122d8dc [Test] Fix module names according to MPP module conventions in test data 2021-01-12 18:35:29 +03:00
Dmitriy Novozhilov 285ccf7583 [Test] Don't generate JVM BB tests for expect-actual linker
This feature is supported only on JS backend so those tests on JVM
  are meaningless. Also those tests had passed on jvm because of
  old codegen tests didn't use `MODULE` directive and analyze all
  files in tests in single module
2021-01-12 18:35:27 +03:00
Dmitriy Novozhilov 3a41f1e435 [Test] Filter out support module with coroutine helpers from module deps
In old tests coroutine helpers was added as separate module named `support`
  instead of additional files for current module.
So to safe compatibility with old testdata we need to filter this dependency
2021-01-12 18:35:26 +03:00
Dmitriy Novozhilov 7e92fb8eb9 [Test] Remove redundant empty IGNORE_BACKEND directive 2021-01-12 18:35:23 +03:00
Dmitriy Novozhilov e0cd830a0e [Test] Drop codegen tests for experimental coroutines
Experimental coroutines was deprecated in Kotlin 1.3,
  so since Kotlin 1.5 we don't support (and don't test) them
2021-01-12 18:35:18 +03:00
Svyatoslav Kuzmich ab753625fe [JS Legacy] Fix returning Char from suspend functions (KT-44221)
Mark translated expression with a proper type, like we do with
non-suspending calls, to coerce it later.
2021-01-12 15:42:31 +03:00
Svyatoslav Kuzmich 2d88ff6fb2 [JS IR] Fix unsgined integer default arguemtns (KT-44180)
Const lowering didn't exprect null constants with unsigned number
types and crashed with NPE. This commit fixes that.
2021-01-12 15:42:31 +03:00
Iaroslav Postovalov 77180a5b13 [JVM IR] Make file classes with all private members package-private 2021-01-12 12:47:59 +01:00
Jinseong Jeon d53354057a FIR: build functional type for SAM with receiver properly 2021-01-12 10:33:55 +03:00
Kristoffer Andersen 43b61a618d [IR+Tests] Improve Local Function Debugging Experience
This change improves the debugging experience around local functions
on the IR backend. The changes include moving old
checkLocalVariablesTable (cLVT) tests to the new stepping/local variable
infrastructure in order to refine the tests and further define the
behavior of the two JVM backends, and their differences.

The primary ported test case is cLVT/localFun.kt that documents the
discrepancy in implementation strategy for local functions on the two
backends. The old backend implements local functions as lambdas
assigned to a local variable while the IR backend lifts them out as
static funtions on the surrounding class. The discrepancies and their
consequences are documented in bytecodeListing, idea-stepping,
localVariableTable and debugStepping tests.

The only _code change_ is disabling the captured variable name
mangling for captured variables on the IR backend. Captured variables
are passed as arguments to the static function, so in the debugger,
they really just are local variables. For them to show properly in the
debugger and be detectable by evaluate expression, they simply need no
mangling.

Finally, this change cleans 3 redundant cLVT tests, copyFunction.kt
and destructuringInlineLambda.kt and destructuringInFor.kt, that are
all covered in the new suite. The stepping behavior needs to be made
precise around for loops, but that is an entirely seperate issue.
2021-01-11 18:21:23 +01:00
Alexander Udalov c2d7b69e5f Remove bytecode text test kt15806.kt
It's not correct to expect that the backend generates the `when` in this
test as tableswitch because there are only two branches. JVM IR has a
cutoff in the when optimization and generates `when`s with fewer than 3
branches as if-else chains, which is probably better. Note that there's
also a corresponding box test in when/enumOptimization/, so the backend
behavior is still tested.
2021-01-11 17:27:03 +01:00
Alexander Udalov 92f3b759c0 Fix codegen test data for genericTypeWithNothing.kt
#KT-18367 Fixed

Co-authored-by: Zalim Bashorov <zalim.bashorov@jetbrains.com>
2021-01-11 17:20:55 +01:00
Dmitry Petrov b02a9846d0 IR KT-44233 support flexible nullability in IrTypeSystemContext
^KT-44233 Fixed Target versions 1.5-M1
2021-01-11 17:33:50 +03:00
Jinseong Jeon 093f62caac FIR2IR: check non-parameter Unit type for adapted callable references 2021-01-11 16:23:00 +03:00
Mads Ager dfc86feecd [IR] Extend test coverage for smart cast handling. 2021-01-11 12:01:48 +03:00
Mads Ager 6fc0de39c2 [PSI2IR] Propagate smart cast information for variable loads.
This gives us more precise type information and can enable backend
optimizations. This was motivated by when expressions not compiled
to table switches in the JVM_IR backend.

Fixed KT-36845.
2021-01-11 12:01:47 +03:00
Steven Schäfer 98a9e142e8 JVM IR: Fix visibility of protected/private functions with reified types 2021-01-08 16:35:31 +01:00
Steven Schäfer dad10e94aa JVM IR: Mangle names of $$forInline functions 2021-01-08 16:30:18 +01:00
Jinseong Jeon 7cc06489dd IR: move enum value array initialization out of <clinit>
#KT-44192 Fixed
2021-01-07 23:00:37 +01:00
Jinseong Jeon f8f08e8134 IR: add a test about maximum number of constants in an enum class 2021-01-07 23:00:37 +01:00
Ilya Chernikov 1bd6cc823c Fix provided properties access generation
The presense of accessors in the descriptor led to the wrong code
generation in some cases.
#KT-43176 fixed
2021-01-07 10:37:20 +01:00
Alexander Udalov bf3f6594d5 IR: do not lose $default function annotations when generating calls
Losing an annotation like `JvmName` resulted in the incorrect bytecode
generated in the JVM IR backend.

 #KT-44160 Fixed
2020-12-31 18:36:24 +01:00
Svyatoslav Kuzmich b6ad1584c9 [Wasm] Improve interface method dispatch
- Use typed Wasm tables for each interface method to avoid runtime
  function type check

- Use linear search by implemented interface rather than by individual
  virtual function signature
2020-12-30 19:29:10 +03:00
Shagen Ogandzhanian e7dc199ad7 Init enum entries whenever we access companion object or accessing valueOf
Fixes https://youtrack.jetbrains.com/issue/KT-43987
Fixes https://youtrack.jetbrains.com/issue/KT-43989
2020-12-30 14:54:34 +01:00
Dmitry Petrov 7fa04afda2 JVM_IR KT-32115 fix $$delegatedProperties initialization in enum 2020-12-30 15:56:18 +03:00
Dmitry Petrov 81e00ca371 JVM box tests for KT-30402 2020-12-30 10:57:46 +03:00
Ilmir Usmanov 80289e4a3f IC Mangling: Generate inline class literal instead of underlying type
literal in annotations.
 #KT-30280 Fixed
2020-12-30 03:31:08 +01:00
Mikhail Glukhikh a6534c4653 [FIR] Fix completion of synthetic call arguments 2020-12-29 17:48:15 +03:00
Victor Petukhov 30a5eee481 Don't approximate abbreviation during substitution it as it can't be projected at top-level
^KT-42036 Fixed
2020-12-29 16:08:38 +03:00
Dmitry Petrov 5d4b0b19d4 JVM_IR KT-13213 split string constants into parts of acceptable length 2020-12-28 16:50:29 +03:00
Denis.Zharkov acbf382d04 FIR: Add test on ambiguous vararg
Fix is in the two previous commits
2020-12-28 13:19:23 +03:00
Victor Petukhov 37473ad640 Substitute lambda's receiver type during completion including the builder inference stub variables substitution
^KT-42175 Fixed
2020-12-25 21:33:37 +03:00
Svyatoslav Kuzmich 672859d447 [Wasm] Support init blocks in inline classes 2020-12-25 17:00:23 +03:00
Svyatoslav Kuzmich 0945c110bf [JS IR] Support init blocks in inline classes 2020-12-25 17:00:23 +03:00
Mikhail Glukhikh 776c4ba6ca Add test for KT-25489 (to reproduce, turn UL classes OFF) 2020-12-25 14:06:16 +03:00
Victor Petukhov 50a388aec1 Mute wasm tests around builder inference and callable references 2020-12-25 11:53:21 +03:00
Victor Petukhov 0dde5ddd7e Fail calls constraints of which contain uninferred type parameter
^KT-44055 Fixed

It's possible only if there is a callable reference among subcalls which go though the old type inference (and the error for uninferred type parameter wasn't reported)
2020-12-25 11:53:16 +03:00
Victor Petukhov 4c56962678 Report errors on callable references which contains postponed type variables in the receiver type 2020-12-25 11:53:15 +03:00
Victor Petukhov 1926434b18 Report error about uninferred type parameter for some special call' subcalls 2020-12-25 11:53:14 +03:00
Victor Petukhov 0b472f858b Don't create DONT_CARE type for CR and lambdas within builder inference calls
It leads to leak such type to the back-end. Calls within a builder call should be updated without marking CR and lambdas with DONT_CARE type.

^KT-43845 Fixed
^KT-43956 Fixed
^KT-42622 Fixed
2020-12-25 11:53:14 +03:00
Victor Petukhov b4d8adeeb4 Don't clean type info for containment operator if the resolution was unsuccessful, but all diagnostics were about only input types and non-strict only input types check was enabled 2020-12-25 11:53:09 +03:00
Victor Petukhov 954c9cecca Compute type for callable references and lambdas inside not null assertion if couldn't get already recorded type 2020-12-25 11:52:59 +03:00
Victor Petukhov 39e579db91 Move tests for builder inference into the corresponding directory 2020-12-25 11:25:39 +03:00