Commit Graph

6180 Commits

Author SHA1 Message Date
Igor Chevdar caa852061a [box-tests] Ignored a test for K/N
More info in https://youtrack.jetbrains.com/issue/KT-44571
2021-06-16 17:25:07 +05:00
pyos 6c1a5e1211 JVM: make inline function argument processing a bit shorter 2021-06-16 12:13:32 +02:00
pyos 392e4fba42 JVM: fix inlining of default lambdas of signature (Result) -> Any
They have no `invoke` bridge, and the overridden invoke expectes a boxed
`Result` as an argument.
2021-06-16 12:13:32 +02:00
Igor Chevdar a1e5bef3ad [box-tests] Ignored some tests for K/N
A file included twice in a source set is not supported for now
2021-06-16 14:27:14 +05:00
Mads Ager 6b6ba77869 [JVM_IR] Trim the expression test string for null assertions.
^KT-47166 Fixed.
2021-06-11 21:54:04 +03:00
Dmitry Petrov bf077b893c PSI2IR KT-47245 handle declaration statements in control structures 2021-06-11 16:42:31 +03:00
pyos 3be348f910 JVM_IR: fix parentClassId for property accessors 2021-06-11 15:03:13 +02:00
pyos 1f9db7cf25 FE: properly clear the deferred generator stack
Before this commit the stack wasn't cleared for read variable case.
#KT-47168 Fixed
2021-06-11 15:56:20 +03:00
Mikhail Glukhikh 3127fad23d FIR: more precise annotation argument serialization 2021-06-09 15:42:39 +03:00
Mikhail Glukhikh 77dd0ad396 FIR: handle custom attributes more precise 2021-06-09 15:42:37 +03:00
Andrey Zinovyev ddc9c1bd1b [FIR] Fix extension property reference resolution
On type with star projection
#KT-44372 Fixed
2021-06-09 15:15:28 +03:00
pyos ade8b0a7d3 JVM_IR: box bound receiver before calling the reference constructor
This is needed for the inliner: since the information about Kotlin type
of the bound receiver is nowhere in the output binary, the inliner will
have no clue how to box inline class values. Moving the boxing outside
the object means the inliner doesn't need to know about it; from its
point of view, the captured value has type `Any`.
2021-06-09 14:36:07 +03:00
Andrey Zinovyev 3572a96bb9 [FIR] Lookup in local sources in default imports based on the flag
Reuse ALLOW_KOTLIN_PACKAGE for that
2021-06-08 08:23:25 +00:00
Dmitry Petrov 81b09ca09f KT-46267 JVM_IR don't generate unnecessary ATHROW in lateinit var read 2021-06-07 20:02:24 +03:00
Denis.Zharkov 592256976e FIR: Fix inference of builder-inference function from expect type
Previously, such calls were being completed with FULL mode and incorrect
INFERENCE_NO_INFORMATION_FOR_PARAMETER has been reported
2021-06-07 15:25:57 +03:00
Denis.Zharkov 5ade831665 FIR: Fix INFERENCE_NO_INFORMATION_FOR_PARAMETER on type alias with generic expansion
^KT-46996 Fixed
2021-06-07 15:25:55 +03:00
Denis.Zharkov d76db0e011 FIR: Mute backend tests relevant to new INFERENCE_NO_INFORMATION_FOR_PARAMETER
See KT-46967 and KT-46996
2021-06-07 15:25:53 +03:00
Denis.Zharkov d932d5b0a5 FIR: Support adding expect type to calls in foo() as R position
See https://kotlinlang.org/docs/whatsnew12.html#support-for-foo-as-a-shorthand-for-this-foo
2021-06-07 15:25:51 +03:00
pyos 0bd8d16fe2 JVM_IR: fix Result types in continuations & remove more codegen hacks
#KT-47129 Fixed
2021-06-07 09:57:42 +02:00
Dmitry Petrov 7fd033adae JVM_IR KT-47073 use type parameter upper bound for default value 2021-06-04 20:54:01 +03:00
Victor Petukhov 1e5998e0ba Add constraints between two different stub variables instead of creating constraint error due to T1 isn't subtype of T2
^KT-44241 Fixed
2021-06-03 19:18:09 +03:00
Victor Petukhov 19c07e048a Don't check suitability of a builder inference call if unrestricted builder inference is enabled
^KT-42139 Fixed
2021-06-03 17:28:40 +03:00
Mikhail Glukhikh 1294c8de53 FIR: don't get class symbol if it's unnecessary (Java type conversion) 2021-06-03 16:14:41 +03:00
Dmitry Petrov 107e71acb0 Minor: fix Android tests 2021-06-03 13:05:23 +03:00
pyos 4128d27510 JVM_IR: do not use invokedynamic for inline fun references 2021-06-03 13:05:23 +03:00
Mads Ager 5d53d34d85 Fix regression test for KT-46962. 2021-06-03 13:05:23 +03:00
Victor Petukhov 124a14c8df Use separate constraint position during call substitution as part of inferring postponed type variables
^KT-47052 Fixed
^KT-47082 Fixed
2021-06-03 12:37:17 +03:00
pyos d5d3d9f112 Add regression tests for KT-46890 and other stuff 2021-06-03 12:35:25 +03:00
pyos 288451db4d JVM_IR: remove an unnecessary hack from BridgeLowering
Correct IR is more important than whether some inaccessible members
precisely match what was generated by the old backend.
2021-06-03 12:35:23 +03:00
Dmitry Petrov 7a43c2de79 JVM remove dead code during constant condition elimination
This avoids an extra call to 'analyze', which is rather costly.

Update debugger testData: Constant condition
elimination now performs DCE more consistently.
2021-06-03 00:08:27 +03:00
Mads Ager 0b5ec5535c [JVM_IR] Add String.plus(Any) to intrinsics list.
This filters it out for use in SAM wrapper generation with
invoke-dynamic.

The intrinsic is not actually used for code generation so
it is added to the list of intrinsics that should have been
lowered away before codegen.

^KT-45779 Fixed
2021-06-03 00:04:47 +03:00
Roman Artemev 5f65b46dfc [JS IR] Unmute fixed tests 2021-06-02 13:42:35 +03:00
Mads Ager f846dd8ea2 [JVM_IR] Avoid using special names in static inline class replacements.
Fixes KT-46952
2021-06-01 16:22:14 +02:00
Mikhael Bogdanov a8186d19d6 Support annotations on class type parameters
#KT-43714
2021-06-01 06:33:50 +02:00
Dmitry Petrov 9091ca7b51 JVM_IR KT-46864 handle "unused" LDC instructions properly 2021-05-31 21:12:35 +03:00
Mads Ager 886ce055f5 [JVM_IR] Do not use invoke-dynamic for targeting inline-only methods.
Fixes https://youtrack.jetbrains.com/issue/KT-46962
2021-05-31 18:11:50 +03:00
pyos 5c2753b5d1 JVM_IR: use substituted return type in function reference invoke
#KT-46982 Fixed
2021-05-31 16:01:22 +03:00
Alexander Udalov 96f0b53761 IR: get overridden directly from IrProperty when resolving fake override
The previous way of getting them either via getter or setter failed on
Java properties which only have a backing field. Now that IrProperty has
overriddenSymbols (after 53c1de172f), it makes sense to use it directly
instead. Use it only in SyntheticAccessorLowering though to avoid
breaking Kotlin/Native (see KT-47019).

 #KT-46900 Fixed
2021-05-28 17:24:20 +02:00
Victor Petukhov 54b9f39b3a Update tests after rebase 2021-05-28 15:36:24 +03:00
Victor Petukhov 76c15e4444 Don't update null recorded type prematurely in ResolvedAtomCompleter 2021-05-28 15:36:23 +03:00
Victor Petukhov bd7fb56a24 Fix builder inference tests 2021-05-28 15:36:23 +03:00
Victor Petukhov e942052eb6 Substitute stub type variables in local variable descriptors 2021-05-28 15:36:22 +03:00
Victor Petukhov 758eb8f851 Fix builder inference tests 2021-05-28 15:36:22 +03:00
Victor Petukhov fd5169186e Update test for the builder inference and add new ones 2021-05-28 15:36:21 +03:00
pyos 34878d17eb JVM: be more careful when removing unused constants
1. if an argument of a `pop` cannot be removed, then all other potential
   arguments of that `pop` can't be removed either, and the same applies
   to other `pop`s that touch them;
2. the same is true for primitive conversions, but this is even trickier
   to implement correctly, so I simply did the same thing as with
   boxing operators: replace the conversion itself with a `pop` and keep
   the argument as-is.

Somehow this actually removes *more* redundant primitive type conversions
than the old code in a couple bytecode text tests, so I've patched them
to kind of use the value, forcing the instructions to stay.

 #KT-46921 Fixed
2021-05-27 12:24:22 +02:00
Andrey Zinovyev c2389a94fa [FIR] Resolve annotations in when expressions 2021-05-27 12:41:16 +03:00
pyos d37ceb47be JVM_IR: use correct dispatch receiver type in more references
#KT-46902 Fixed
2021-05-26 15:23:19 +02:00
pyos 33ddeffcfd JVM_IR: box inline class values returned by suspend inline lambdas
The call site inside the inline function expects them to return a boxed
value, like FunctionN.invoke would.

 #KT-46915 Fixed
2021-05-26 08:33:55 +02:00
Mads Ager d023966054 [JVM] Fix various undefined locals issues.
CoroutineTransformermethodVisitor attempts to extend the ranges
of local variables in various situations. Probably in an attempt
to give a better debugging experience. However, all of these
range extensions lead to invalid local variable tables where
something is in the local variable table where nothing is in the
corresponding slot.

The code that extends variables to the next suspension point
instead of ending them when they are no longer live has issues
with loops. When resuming and reentering the loop, the locals
table will mention a local that we did not spill and which
is therefore not restored when resuming.

The code that extends local variable table entries if there
are no suspension points between two entries doesn't work
for code such as:

```
var s: String
if (suspendHere() == "OK") {
  s = "OK"
} else {
  s = "FAIL"
}
```

If the local variable ranges are collapsed into one, one of
the branches will have the local defined in the local variable
table before the slot is initialized.
2021-05-26 08:33:34 +02:00
Ilya Goncharov c62a965180 [IR] Not try Null constant in fold constant
^KT-46859 fixed
2021-05-25 22:29:58 +03:00