Commit Graph

15533 Commits

Author SHA1 Message Date
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
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
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 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 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
Victor Petukhov 12a39d0330 [FE 1.0] Report errors due to inferred empty intersection on those candidates which were already previously discriminated by CompatibilityOfTypeVariableAsIntersectionTypePart 2022-04-27 19:50:26 +00:00
Victor Petukhov 38913b68b2 [FE] Add additional test for marking with warnings a call resolve of which is going to be changed 2022-04-27 19:50:26 +00:00
Victor Petukhov 39d13442be [FE] Support intersection type emptiness checking for interfaces 2022-04-27 19:50:25 +00:00
Victor Petukhov 1da52ab197 [FE] Add test for KT-51016 2022-04-27 19:50:25 +00:00
Victor Petukhov b32887380a [FE] Move empty intersection tests into separate directory 2022-04-27 19:50:24 +00:00
Victor Petukhov e0a1f1c405 [FE] Review fixes 2022-04-27 19:50:24 +00:00
Victor Petukhov c71ae4301c [FE 1.0] Get rid of absolute CompatibilityOfTypeVariableAsIntersectionTypePart 2022-04-27 19:50:24 +00:00
Victor Petukhov 47d6236a2d [FIR] Support determining emptiness of an intersection type with type parameters' types 2022-04-27 19:50:23 +00:00
Victor Petukhov 5bfe6cd20a [FE] Implement discussed rules to report empty intersection errors 2022-04-27 19:50:22 +00:00
Victor Petukhov b96708c3e2 [FE] Support reporting INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION for empty intersection types with type parameters 2022-04-27 19:50:21 +00:00
Victor Petukhov c16ae81a48 [FIR] Report errors for upper bounded type variables by an empty intersection type
^KT-51221 Fixed
2022-04-27 19:50:21 +00:00
Victor Petukhov 65213e9a42 [FE 1.0] Report warnings or errors for upper bounded type variables by an empty intersection type 2022-04-27 19:50:21 +00:00
Igor Laevsky 3de1235fda [WASM] Add command line option to enable/disable assertions 2022-04-26 20:41:52 +00:00
Dmitriy Novozhilov 19f4c3edda [CLI] Report compilation error if compiler plugins are enabled alongside with K2 compiler
^KT-52037 Fixed
2022-04-26 21:03:04 +04:00
Kristoffer Andersen 4f8ef8c315 [EE-IR] Support Local Functions
This commit introduces support for calling and referencing local functions and
objects in evaluate expression on the IR backend.

The primary incision is a lowering inserted after Local Declaration Lowering,
that uses the intermediate data structures recorded by LDL to rewrite calls to
local functions to the appropriate function in the binary, instead of predicting
the compilation strategy. The required changes to the rest of the pipeline
facilitate piping the required data around.

The key to this transformation is that _captures by the local function_ must be
introduced as _captures by the fragment function_, such that the evaluator
infrastructure can find the appropriate values at run-time. This is necessary
due to the strategy of compiling local functions to static functions instead of
closures.

Additional test coverage of stepping behavior support the corresponding changes
in the Evaluator, part of the Kotlin Debugger plug-in.
2022-04-25 16:59:04 +03:00
Alexander Udalov 24f3c7dc7d Psi2Ir: fix usage of flexible vararg type after approximation
This only affects JVM IR, and this is similar to how this was done in
the old JVM backend in `CallBasedArgumentGenerator.generateVararg`.

 #KT-52146 Fixed
2022-04-22 14:15:28 +02:00
Alexander Udalov 6734f542b3 JVM IR: sanitize indy lambda proxy names correctly
In case there are several proxy functions for indy lambdas in the same
container, its names are "...__proxy", "...__proxy-0", "...__proxy-1",
..., yet before this change, only the first one was sanitized. So if
it's happening inside a constructor, `<init>` was left unrenamed which
led to ClassFormatError.

 #KT-52040 Fixed
2022-04-21 17:06:16 +02:00
Mikhail Glukhikh f65364b191 FIR: add test for #KT-49438 Obsolete 2022-04-20 22:31:54 +03:00
Alexander Udalov 2e515f3945 Prohibit JVM target 1.6
But still compile stdlib, reflect, kotlin.test and scripting runtimes
with JVM target 1.6 to simplify migration from Kotlin 1.6 to 1.7.

 #KT-45165 Fixed
2022-04-19 22:54:40 +02:00
Alexander Udalov ef6d30dd51 Remove usages of JVM target 1.6 from compiler tests
#KT-45165
2022-04-19 22:54:40 +02:00
Ivan Kochurkin 3b8183a736 [FIR] Support of importing optional annotation classes (JS/Native), ^KT-51757 Fixed 2022-04-18 15:36:21 +00:00
Ivan Kochurkin 541fba1531 [FIR] Type argument instead of unexpected type parameter for TypeMismatch error
^KT-49035
^KT-51201 Fixed
2022-04-18 15:36:20 +00:00
Ivan Kochurkin 8c7fad9a5e [FIR] Support of type arguments in annotations ^KT-48444 Fixed 2022-04-18 15:36:19 +00:00
Ivan Kochurkin 05bed8f751 [FIR] Hide local type for return type of single expression function ^KT-51418 Fixed 2022-04-18 15:36:18 +00:00
Mikhail Glukhikh 0ecba0ad0b FIR: don't create incorrect constraints in CallableReferenceResolution
#KT-50994 Fixed
Related to KT-49477
2022-04-18 14:27:42 +00:00
Denis.Zharkov 9c7fea24d1 Fix exception when reporting WRONG_TYPE_PARAMETER_NULLABILITY_FOR_JAVA_OVERRIDE
^KT-51979 Fixed
2022-04-15 12:36:05 +00:00
Denis.Zharkov b8ea48fdc2 Fix exception happening while parsing an incorrect file
^KTIJ-21546 Fixed
2022-04-15 09:10:09 +00:00
Dmitriy Novozhilov 989cef6c3c [FE 1.0] Don't report OVERRIDE_DEPRECATION on default accessors of deprecated properties
^KT-51893 Fixed
2022-04-15 08:30:05 +00:00
Igor Chevdar 231fe42c0a [klibs] Fixed a bug in the signature-to-descriptor searcher
#KT-51927 Fixed
2022-04-14 07:33:56 +00:00
wrongwrong 2da8d53791 Fix callBy for InlineClassAwareCaller in case of >=32 parameters
#KT-51804 Fixed
2022-04-13 23:35:48 +02:00
Ilya Kirillov ffdef50424 [symbol lc] actualize testdata for symbol LC tests 2022-04-13 12:53:30 +02:00
Ilya Kirillov 66df69ea2c [low level fir, tests] temporary mute some tests with the latest full jdk
full jdk paths are not handled well after test infra rework
2022-04-13 12:53:27 +02:00
Ilya Gorbunov 3778b1fde1 Remove ExperimentalStdlibApi no longer required in tests 2022-04-12 15:03:42 +00:00
Mads Ager 1e444e0451 [JVM IR] Limit local variables in do-while conditions.
Locals introduced in the body of a do-while loop are not
necessarily live at the do-while condition. For example,
if there is a continue in the body before the declaration:

    do {
      if (shouldContinue(x))
        continue
      val y = 32  // not always defined in the condition
      doSomething(y)
    } while (x < 2)

For locals referenced in the condition such code is rejected
by the frontend because a local referenced in the condition
must be always defined when you get there.

However, locals that are not used in the condition were always
put in the local variable table. This leads to invalid locals
information which can trip of debuggers and other build tools
such as the D8 dexer.

This patch only puts in locals information for locals actually
referenced in the local variable table for the condition.

^Fixes KT-51754
2022-04-12 15:47:14 +02:00
Roman Golyshev 32fa2fc476 [FIR] Resolve receiver in qualified expressions with no selector
In qualified expression like `foo().`, selector expression is null.
Because of that the whole expression was marked as an error FIR
expression, and `foo()` part was not resolved at all (including
arguments and everything else).

This commit fixes the problem by providing receiver's FIR expression
as an underlying expression for error FIR expression. That way
it will be seen by all resolve transformers and will be successfully
resolved.

^KTIJ-21484 Fixed
2022-04-12 10:55:12 +00:00
pyos d61e7db937 JVM_IR: add a test for when(enum) binary compatibility 2022-04-11 22:50:07 +02:00
pyos a07e21d913 JVM: streamline handling of tail-call suspend functions
Just see if every suspend call is followed only by safe instructions or
returns, then insert a suspension point check if there isn't a direct
return.

The first part of this is equivalent to the old implementation, just
refactored. The second part generates strictly more checks; see, for
example, the fixed test, in which the previous implementation failed to
insert a check before a CHECKCAST.

^KT-51818 Fixed
2022-04-11 17:00:26 +00:00
Ilmir Usmanov 6e30ce2763 FE: Make synchronized suspend functions and lambdas error in 1.8
#KT-27333 Fixed
2022-04-11 12:02:30 +00:00
Ilmir Usmanov f473998e8b FIR: Make 'suspend fun', where 'suspend' is not builtin error in 1.8
#KT-49264
2022-04-11 12:02:29 +00:00
Ilmir Usmanov f75a8109d2 FE 1.0: Make 'suspend fun', where 'suspend' is not builtin error in 1.8
#KT-49264 Fixed
2022-04-11 12:02:28 +00:00