Commit Graph

39708 Commits

Author SHA1 Message Date
Victor Petukhov 7675361380 [FE 1.0] Continue completion of calls inside that builder inference call postponed type variables of which has already been inferred 2022-05-09 12:38:39 +00:00
Victor Petukhov b8030ec1de [FIR] Substitute lambda implicit receivers with builder inference stub types
^KT-51988 Fixed
2022-05-09 12:38:38 +00:00
Victor Petukhov 6027c2a9aa [FE] Substitute fixed type variables with inferred stub types
Actually, a type variable might be fixed into a stub type. Such stub type should be substituted before sub calls completion

^KT-51988 Fixed
2022-05-09 12:38:37 +00:00
Jinseong Jeon af32a65c78 AA: use existing utils to define library scope
No visible differences from end clients, and we can avoid uses/shares of
Jar file system across modules
2022-05-09 00:22:52 +02:00
Victor Petukhov 94433a1600 [FE 1.0] Postpone turning NON_VARARG_SPREAD_WARNING into error till 1.8 to have a deprecation cycle of proper duration
^KT-48162
2022-05-08 10:49:16 +02:00
Kristoffer Andersen a9479ec8d7 [EE-IR] Anticipate fake overrides in fragment lowerings 2022-05-06 22:10:19 +02:00
Alexander Udalov ba20549e13 Fix JVM target in tests using boolean comparisons
These tests don't work on JVM target 1.6 after 6d664bcd10 because we're
generating `Boolean.compare` which is only available since 1.8. (It is
not a big deal because JVM target 1.6 is prohibited for users now.)
2022-05-06 03:47:25 +02:00
Alexander Udalov 6d664bcd10 JVM IR: fix operand type for CompareTo intrinsic
It's incorrect to take the first parameter type from the expression
itself because it can be nullable if smart casts are used. And if it's
nullable, it's mapped to the wrapper type and calling
`comparisonOperandType` for it makes no sense. Instead, take the type
from the callee function, as it's guaranteed to be mapped to a JVM
primitive type.

E.g. in `test1` function in the added test, the problem was that the
dispatch receiver type of the call expression is `Double?`, which is
mapped to `java/lang/Double`, whereas we clearly wanted to obtain the
primitive `D` (double) type.

 #KT-52163 Fixed
2022-05-05 23:06:21 +02:00
Zalim Bashorov 11d9751844 [Wasm] Unmute inlineVararg 2022-05-05 21:03:39 +00:00
Zalim Bashorov 76806eba8a [Wasm] Mute failing tests in boxInline 2022-05-05 21:03:38 +00:00
Zalim Bashorov 2c20a71d08 [Codegen tests] Specify JVM as target backend for inferenceFlexibleTToNullable.kt 2022-05-05 21:03:37 +00:00
Zalim Bashorov a6e8912af0 [Wasm] Mute failing tests in box/delegatedProperty 2022-05-05 21:03:36 +00:00
Zalim Bashorov 6ebeeabe0f [Codegen tests] Fix the test (kt39588)
For negative case, throwing CCE, we already have the issue KT-8135
and dedicated tests:
* genericDelegateUncheckedCast1.kt
* genericDelegateUncheckedCast2.kt

Related issues: KT-8135 KT-39588 KT-48749 KT-49837
2022-05-05 15:47:54 +00:00
Mads Ager c6d7c23940 Always take java source before class files.
Also when searching for inner classes.

^Fixes KT-51025
2022-05-05 13:21:06 +02:00
Ilya Kirillov 7c202948cd [fir low level, fir] extract empty FirPredicateBasedProvider to a separate class 2022-05-05 10:43:12 +02:00
Alexander Korepanov 57f16e801f [JS IR] Materialize Unit more aggressively for IrCalls
Unit materialization for IrCall is required for operations with dynamic type.

However it produces useless Unit_getInstance() calls,
especially in return expressions. The pach also adds some heuristics
for reducing the amount of Unit_getInstance() calls from return expressions:
do not add Unit_getInstance() if return value has Unit type.

Relaited to KT-51139
^KT-23252 Fixed
2022-05-04 13:14:06 +00:00
Mikhail Zarechenskiy 677ec12b50 Revert "[EE-IR] Minor: run local function patching on all fragment code"
This reverts commit 722d876675.
Unfortunately, this commit breaks debugger tests in intellij part
2022-05-04 14:56:33 +02:00
Artem Kobzar 729e24d053 fix: make sealed classes abstract inside d.ts files. 2022-05-04 11:24:47 +00:00
Artem Kobzar a2b40acc98 feat: add WARNING on usage top-level exportable declarations with non-consumable identifiers. 2022-05-04 11:22:57 +00:00
pyos 239bcea3b9 JVM: write back to tailrec function parameters if possible
This makes the debugger update the values when entering a recursive
call, and also uses fewer variable slots.

This may also work on the JS backend, but Native would probably require
something else.

^KT-47203 Fixed
2022-05-04 10:00:08 +02:00
pyos ca446f008e IR: add a do-while builder function 2022-05-04 10:00:08 +02:00
Kristoffer Andersen 722d876675 [EE-IR] Minor: run local function patching on all fragment code 2022-05-04 01:41:13 +02:00
pyos effd21d074 JVM_IR: do not optimize suspend$$forInline functions
`$$forInline` functions do not pass through the state machine generator,
and optimizing `Ref`s before that changes how assignments inside lambdas
passed to `suspendCoroutine`, etc. behave: without a `Ref`, the
assignment is not reflected in the continuation object, so the variable
has old value on resumption.

These functions will be optimized later, after they are inlined
somewhere and the state machine is generated.

^KT-52198 Fixed
2022-05-02 20:18:08 +02:00
pyos 153f878df4 Convert OptimizationClassBuilder to Kotlin 2022-05-02 20:18:08 +02:00
pyos 0ec5975730 JVM: ignore non-meaningful instructions during peephole optimization
Also, produce more nops, since they no longer take up memory for frames
and a later pass will remove the unneeded ones anyway.
2022-05-02 19:28:10 +02:00
pyos c43acba0b9 JVM: restore call site line number after inlining lambda
E.g. in `x + f()` where `f` is an inline lambda, the instructions for
`+` should have the line number of that expression (while previously
they instead had the line number of the last line of the lambda).

^KT-51738 Fixed
2022-05-02 19:28:10 +02:00
pyos 9d3a5e93d4 JVM: reuse Frames of instructions that do nothing
This saves some RAM when optimizing functions with lots of line numbers.
2022-05-02 19:28:10 +02:00
pyos db62640ae2 JVM: remove InlineOnlySmapSkipper
1. the class didn't make much sense anyway;
2. the same code is useful for default lambdas, which can also have
   a line number equal to the call site.
2022-05-02 19:28:10 +02:00
Mikhail Glukhikh 15d58aff92 K2: drop C/DFA warning which fixes can break compilation in K1 till 1.8
#KT-50965 Fixed
2022-05-01 16:40:04 +00:00
Nikolay Lunyak cc086bed58 [FIR] Use a tree with the proper root node
This commit ensures all the conversions inside the lambda expression
use the correct tree reference.

Otherwise, the problem arises in the
`toFirSourceElement()` call: if called form inside the
ExpressionsConverter, everything is OK, but calling it from inside
DeclarationsConverter will result in the wrong source text range.
This happens, because during the lambda expressions conversion a custom
ExpressionsConverter is created with the `lambdaTree` tree, but the
DeclarationsConverter continues to use the previous tree.
2022-04-30 19:51:57 +00:00
Ilya Goncharov 1fc7fbed79 rra/ilgonmic/export-call-site
[JS IR] Add test with exported overridden property from interface

[JS IR] Accessors should not be exported when overridden from non-exported interface

Merge-request: KT-MR-6166
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>

^KT-52144 fixed
2022-04-29 12:13:09 +00:00
Ilya Chernikov cdb5845693 [minor] fix double warning about FastJarFS 2022-04-29 11:03:13 +00:00
Ilya Chernikov a78d063bef Scripting: fix script type extraction on psi2ir
#KT-48812 fixed
2022-04-29 11:03:12 +00:00
Ilya Chernikov 49902bb851 IR Scripting: allow to specify nullable types for provided props...
but only explicitly. This does not fix a breaking change described in
#KT-52120, because it seems the correct behavior, but it allows
to "workaround" the problem by specifying nullability explicitly.
Also improve handling of nullable bindings in JSR-223.
#KT-49173 fixed
#KT-51213 fixed
2022-04-29 11:03:11 +00:00
Dmitriy Novozhilov c2bb8d6de0 [Test] Fix CLI tests due to migration from -Xuse-fir to -Xuse-k2 flag 2022-04-29 12:26:01 +04:00
Igor Chevdar f62e4e7b97 [klibs] Refactored BasicIrModuleDeserializer 2022-04-28 19:11:14 +00:00
Igor Chevdar 31eedebec6 [klibs] Added deserialization strategy: on-demand
With on-demand strategy only file header is deserialized
2022-04-28 19:11:13 +00:00
Artem Kobzar 025a21761b fix: change logic of calculation fqName for export model. 2022-04-28 15:54:50 +00:00
Simon Ogorodnik 58885a1b07 KT-52217 Rename 'use-fir' to 'use-k2', update message 2022-04-28 15:42:42 +00:00
Mikhail Glukhikh 08ba89b4ec CLI K2: report an error for JS/Native/Metadata #KT-52035 Fixed 2022-04-28 13:25:48 +00:00
Mads Ager 17b5e46547 [FE1.0] Fix CFG for inline function calls in finally blocks.
The body of the InlinedLocalFunctionDeclarationInstruction was
not copied. That confuses the information on the exceptional edge
with the information on the normal edge.

^KT-52131 Fixed
2022-04-28 14:39:59 +03:00
Igor Laevsky d46102b129 [Wasm] Fix few things around assertions in stdlib 2022-04-27 20:21:21 +00:00
Victor Petukhov 6c54b78574 [FE 1.0] Don't capture projections during compatibility check of supertypes to determine intersection type emptiness 2022-04-27 19:50:30 +00:00
Victor Petukhov 73be9d0a20 [FE] Don't check intersection emptiness if there were lower constraints 2022-04-27 19:50:30 +00:00
Victor Petukhov d4d45a8410 Fix wrong inferred type argument in InlineCodegen::inlineCall 2022-04-27 19:50:29 +00:00
Victor Petukhov 20a8e5d742 [FE] Determine intersection type emptiness by looking at supertypes properly: substitute their type arguments 2022-04-27 19:50:29 +00:00
Victor Petukhov a0260292ec [FIR] Remove always-false check for type of candidate while collection candidates 2022-04-27 19:50:28 +00:00
Victor Petukhov 54f0794ce3 [FE] Substitute erased type parameters as covariant 2022-04-27 19:50:28 +00:00
Victor Petukhov fb76d819f0 [FE] Erase type parameters of super types during intersection type emptiness check as well 2022-04-27 19:50:27 +00:00
Victor Petukhov 0f1d212fc5 [FE] Fix tests 2022-04-27 19:50:27 +00:00