Commit Graph

99 Commits

Author SHA1 Message Date
Nikolay Lunyak a9343aeb7d [FIR] KT-55840: Ensure everything actually works
This inconsistency is present due to not using the `// WITH_STDLIB`
in the above tests. When K1 creates the enum, it tries to generate
`entries()`, and for that it tries to load `kotlin.enums.EnumEntries`,
but this is actually an unresolved reference. K1 silently swallows it,
and proceeds.

The reason K2 doesn't fail is that in order to generate `entries()` it
simply creates the necessary `ConeClassLikeType` with the desired
`classId` instead of loading the whole `ClassDescriptor`.

The reason we can still observe `$ENTRIES` and `$entries` in K1
is because they are generated during the JVM codegen, and it
only checks if the `EnumEntries` language feature is supported. It
doesn't check if the `entries` property has really existed in IR
(by this time it's expected to have already been lowered to the
`get-entries` function - that's why "has ... existed").

The reason why the codegen doesn't fail when working with
`kotlin.enums.EnumEntries` is because it creates its
own `IrClassSymbol`.

^KT-55840 Fixed

Merge-request: KT-MR-8727
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-02-10 16:57:51 +00:00
Ilya Chernikov 78ca733c38 FIR JS: add K2 variants of all other JS tests
except tests that are not possible to add without some modifications in
the test infra. See todos on the commented-out test declarations
2022-11-12 16:28:24 +01:00
Alexander Korepanov 01507281a2 [Common IR] Forward the extension receiver in the reified wrapper
^KT-53672 Fixed
2022-09-05 07:40:30 +00:00
Alexander Udalov 19bbcc5869 Do not generate metadata for callable reference classes
After an accidental change in 846537b367, we started generating metadata
into anonymous classes for callable references. This metadata contained
the Kotlin representation of the referenced function. In KT-53794, this
led to a problem where Java's protected visibility could not be
represented in Kotlin terms, which crashed the backend.

But also, this metadata is useless because there's no real use case for
interpreting it (since you already have a function reference object at
runtime with all the needed information), so it would take some extra
space in the bytecode.

 #KT-53794 Fixed
2022-09-01 12:15:25 +02:00
Mads Ager 59c2bde10a [K/N] Unmute passing tests. 2022-08-01 08:57:16 +00:00
Steven Schäfer 7d59c7689c JVM IR: Avoid direct invokes in callable reference tests
Due to the direct invoke optimization, most callable reference tests
were not generating callable references/lambdas.
2022-07-14 23:24:18 +02:00
Ivan Kochurkin 522d2064bb [FIR2IR] Initialize fake overrides for callable references 2021-12-09 12:31:24 +00:00
Mikhail Glukhikh cf104c8433 FIR: add status line to all failing black box tests 2021-11-20 03:37:31 +03:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Igor Yakovlev ce360bb10b [WASM] Implementation of Class references 2021-11-15 19:53:46 +03:00
Alexander Udalov 1071919706 Remove backend tests on old inference
Also remove any mentions of NewInference, and rename some tests.
2021-11-09 20:07:33 +01:00
Igor Laevsky e331a52e75 [Wasm] Mute/unmute box tests after kotlin.test support 2021-10-14 17:24:05 +03:00
Svyatoslav Kuzmich 9ef899ef10 [Wasm] Reuse Callable reference and SAM lowerings from JS 2021-10-08 07:24:41 +03:00
Svyatoslav Kuzmich 1ed2748334 [Wasm] Generate [K][Suspend]FunctionN on demand and support big arity 2021-10-08 07:24:41 +03:00
Svyatoslav Kuzmich aa5f98f919 [JS] Remove KJS_WITH_FULL_RUNTIME for tests that already have WITH_RUNTIME 2021-10-07 22:36:18 +03:00
Svyatoslav Kuzmich 6eb81517a0 [Wasm] Unmute passed Wasm tests 2021-10-02 06:14:35 +00:00
Svyatoslav Kuzmich c88cde2f8b [Wasm] DONT_TARGET_WASM_BACKEND => IGNORE_BACKEND in testdata 2021-10-02 06:14:35 +00:00
Svyatoslav Kuzmich ab9a23cbfa [Wasm][Stdlib] Reuse K/N collections and StringBuilder 2021-10-01 17:18:49 +03:00
Svyatoslav Kuzmich 6db7154876 [Wasm] Build bridges for non-virtual functions that implement interfaces 2021-09-22 19:49:43 +03:00
Igor Yakovlev 41a69ad388 [WASM] Add receiver capturing to callable references 2021-09-20 19:08:22 +03:00
Mads Ager b51ff799cb Fix IteratorNext intrinsic to cast its dispatch receiver to
the expected type.

^KT-47741 Fixed.
2021-07-16 21:07:11 +02: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 d5d6736e67 PSI2IR/FIR2IR: do not approximate T!! before translation
This leads to weird effects when it's in a contravariant position,
because it's approximated by Nothing.
2021-05-12 11:37:48 +03:00
pyos a37db99841 JVM_IR: remove a hack from InlineCallableReferenceToLambda
It breaks other things, the same problem is hit by FunctionReference,
and it's the translation layer's fault anyway.

 #KT-46555 Fixed
2021-05-12 11:37:47 +03: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
Denis Zharkov 14305d1eba FIR: Simplify callable references resolution
Also that fixes some bugs
2020-11-16 15:50:39 +03:00
Svyatoslav Kuzmich fdd7fa5aea [Wasm] Mute codegen box tests 2020-11-09 16:04:43 +03:00
Alexander Udalov 2f003bdcb5 Minor, add regression test
#KT-42527
2020-10-07 21:31:43 +02:00
Denis Zharkov 3dfbd36f15 FIR: Unmute passing blackbox tests 2020-10-01 17:49:02 +03:00
Jinseong Jeon 72dea05854 FIR2IR: approximate type argument if reified 2020-09-17 09:43:46 +03:00
Dmitriy Novozhilov b21a0213df [NI] Get rid of FE 1.0 types in AbstractTypeApproximator 2020-08-28 10:59:51 +03:00
Ilya Gorbunov 2fe222e8e7 Add SKIP_DCE_DRIVEN directive in JS-IR tests
Otherwise they fail with a compiler exception:
"An operation is not implemented: SAM conversion"
2020-06-17 19:45:15 +03:00
Mikhail Zarechenskiy 718f23b34f Compatibility warning for references to companion via name (KT-13934) 2020-06-05 13:24:18 +03:00
simon.ogorodnik 8afbb4542b [FIR2IR] Fix check if interface is SAM 2020-05-29 21:10:56 +03:00
Vitaly fe047f9b47 [JS BE] mutes tests for JS_IR_ES6, which muted for JS_IR 2020-05-27 00:32:56 +03:00
Denis Zharkov e1e149a062 FIR: Support coercion-to-unit semantics for callable references 2020-05-18 11:17:45 +03:00
Mikhail Glukhikh e7e80be34a [FIR2IR] Populate overridden symbols even for !isOverride
Before this commit we considered !isOverride as a sign that
function / field / accessor has no overridden symbols.
However, it's false for deserialized, because isOverride
is always false there.

This commit fixes 68 BB tests but breaks 25 BB tests (not yet muted)
2020-05-14 13:40:36 +03:00
Mikhail Glukhikh 96d8b0bea3 FIR: make KFunctionX derived from KFunction 2020-04-20 17:05:37 +03:00
simon.ogorodnik 356e42196c [FIR2IR] Fix inner class constructor receiver parameter type 2020-04-13 20:26:19 +03:00
Mikhail Glukhikh a377a6fccb [FIR2IR] Handle references to constructors separately 2020-03-31 20:27:40 +03:00
Jinseong Jeon 078cf02c8a FIR: Provide dispatch receiver for 'field' according to property type 2020-03-30 16:57:53 +03:00
Mikhail Glukhikh d4ae992417 [FIR] Apply type arguments for callable references 2020-03-30 16:23:11 +03:00
Mikhail Glukhikh 697006d782 [FIR2IR] Re-use receiver application logic in callable ref conversion 2020-03-30 16:23:10 +03:00
Jinseong Jeon cdf5a2a5a1 FIR: set dispatch receiver parameter for inner class's constructor. 2020-03-25 12:40:09 +03:00
Mikhail Glukhikh 9836520287 [FIR2IR] Generate synthetic bodies for Enum.values() and valueOf() 2020-03-20 11:55:34 +03:00
Mikhail Glukhikh 20c4a7b244 [FIR2IR] Introduce staged transformation (first step)
Now FE IR -> BE IR transformation is performed in multiple stages
controller by Fir2IrConverter. Stages are
 * files & classes registration
 * supertypes & type parameters handling
 * functions & properties signature generation
 * body generation

After each step we have guarantee (with exception of local classes &
type inference combination, and external symbols) that required symbols
(class/function/property/variable/type parameter)
are already bound to real declarations and have correct parents.

This commit also fixes incorrect parents for local classes
2020-03-13 12:18:02 +03:00
Steven Schäfer bb5a639153 JVM IR: Turn static callable references into singletons 2020-03-05 22:19:53 +03:00
Roman Artemev 161bb72439 [JS IR] Update test data 2020-03-03 18:54:36 +03:00
Mikhail Glukhikh 2308e5bb7c FIR2IR: in case of use-site generic type use call from original class 2020-02-28 15:29:02 +03:00
Mikhail Glukhikh 096dc25701 FIR: change callableId of fake overrides to derived class owner 2020-02-28 15:29:02 +03:00