Commit Graph

6164 Commits

Author SHA1 Message Date
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
Andrey Zinovyev 64b45e6d1b Add comments to skipped FIR tests 2021-05-25 19:23:30 +03:00
Andrey Zinovyev dce8bd4e62 [FIR] Support constructor call of unsigned in checker 2021-05-25 19:23:29 +03:00
Andrey Zinovyev 7f2eaab02b [FIR] Support for constructor calls of unsigned types in constants 2021-05-25 19:23:27 +03:00
Mikhail Glukhikh 1b7425f428 FIR mangler: handle situation with invisible type in f/o signature
Before this commit, FIR mangler effectively dropped f/o parameter with
invisible type from this module. It could lead to signature clashes.
Now we insert classId in mangler string instead.
This fixes FIR bootstrap.
2021-05-25 11:38:48 +03:00
Dmitry Petrov 261b42f5c5 JVM_IR KT-46822 don't generate too deep StringBuilder.append trees 2021-05-21 22:28:54 +03:00
Dmitry Petrov ba00709e4d JVM_IR KT-46839 lower varargs for *arrayOf function references 2021-05-21 22:06:52 +03:00
Alexander Udalov 6ca7b39f6a Psi2ir: do not load abbreviated types with not found classifier
This is not an ideal fix of the problem since the fact that
AbbreviatedType's classifier should be a TypeAliasDescriptor is a
reasonable assumption that might fail somewhere else, later in the
pipeline.

Previous attempts to fix this issue that were unsuccessful:

1) Do not load abbreviations for such types in deserialization at all.
   Unfortunately, it broke quite a few things like reflection and
   decompiler, where types frequently refer to symbols not reachable
   from the point where they're requested, yet we have the FQ name of
   the typealias, which is enough to render the abbreviation properly in
   both these use cases.

2) Load classifiers for unresolved abbreviations as
   MockTypeAliasDescriptor instead of MockClassDescriptor in
   NotFoundClasses. Technically this was a revert of
   e19c1b5364. But this failed because we
   don't have enough information about such typealias to correctly set
   its `expandedType`/`underlyingType` (just using nullable Any as
   before that commit is not good enough). We only know its underlying
   class (from one usage of such typealias), and even supporting that
   would involve a major refactoring of TypeDeserializer which is
   painful.

 #KT-45308 Fixed
2021-05-21 19:36:30 +02:00
Denis.Zharkov f0c85e0935 FIR: Add comments to freshly muted tests 2021-05-21 13:53:55 +03:00
Andrey Zinovyev a121061df7 [FIR] Get module name for deserialized fir2ir classes 2021-05-21 12:49:58 +03:00
Dmitry Petrov c0fbdb1535 JVM_IR KT-46840 don't generate special function references with indy 2021-05-20 21:13:17 +03:00
Denis.Zharkov 4433dffbd3 FIR: Mute test that should be disabled since 1.6 2021-05-20 17:24:47 +03:00
Denis.Zharkov d0a0739d10 FIR: Mute builder-inference related tests
They started failing once we began reporting diagnostics from completion

^KT-46421 Relates
2021-05-20 17:24:16 +03:00
Denis.Zharkov 78ec4b5248 FIR: Mute property-delegation-inference related tests
They started failing once we began reporting diagnostics from completion
The main reason is that we resolve `delegate()` call
from `delegate().getValue()` in the independent context, while in FE 1.0
it's being resolved within the same system as getValue

^KT-46420 Relates
2021-05-20 17:24:15 +03:00
Denis.Zharkov cd401b5b8a FIR: Update integer literal-related tests
They started failing once we began reporting diagnostics from completion

^KT-46419 Relates
2021-05-20 17:24:14 +03:00
Alexander Udalov 8dee36d420 Tests: do not add transitive dependencies in multi-module tests
Prefer to have all module dependencies, including dependencies on
stdlib/reflect, declared explicitly. This allows to have tests on
situations like the one in KT-45308: three modules A<-B<-C, where C
doesn't depend on A, which was compiling correctly with the old JVM
backend before 1.5, but started to fail with JVM IR in 1.5.

Also simplify the code a bit, remove duplicated logic.
2021-05-20 15:58:05 +02:00
Steven Schäfer 984e912f8d JVM IR: Do not unbox Results in suspend lambda invoke methods (KT-46813) 2021-05-20 14:40:00 +02:00