Commit Graph

101 Commits

Author SHA1 Message Date
Ivan Kochurkin 968ecadff2 [FIR2IR] Erasure type of parameter of delegated property in K1 manner
Add `shouldEraseType` to `Fir2IrConversionScope`

^KT-62884 Fixed
2024-02-01 15:36:32 +00:00
vladislav.grechko 34bac48541 Add JVM ABI K1/K2 consistency tests 2023-12-26 10:18:19 +00:00
Dmitriy Novozhilov 89b98ef784 [FIR2IR] Properly create FIR f/o for lazy IR f/o
```kotlin
interface A {
    fun foo() // (1)
}

interface B : A {
    // f/o fun foo() // (2)
}
```

In previous commits it was forgotten to create new FIR declarations for
  IR fake-overrides, which led to the situation when `IR lazy functions
  of `(1)` and `(2)` both contained fir of function (1) as their base
  declaration

It seems this change fixed some cases from KT-42020
2023-11-20 13:36:28 +00:00
Vladimir Sukharev c38a0e10af [K/N] Implement a concept of conditional ignore of K/N blackbox tests
^KT-59288 Fixed
2023-11-15 19:03:07 +00:00
Alexander Udalov fda47c45ec IR: do not change overrides for lazy IR in FakeOverrideRebuilder
`FakeOverrideBuilder.provideFakeOverrides` recursively changes overrides
for all superclasses in the hierarchy, including lazy IR, which is a lot
of extra work.

Also it leads to some tests failing in the IR fake override builder mode
because it changes correct fake overrides of Java classes to incorrect
ones. Those tests are unmuted but it doesn't mean they are fixed -- most
likely we'll generate fake overrides via IR for lazy IR too, at which
point they'll start to fail again.
2023-09-15 12:55:33 +00:00
Pavel Kunyavskiy 91e96e9f31 [Fir2Ir] Introduce testing with IrFakeOverrideBuilder
^KT-61514
2023-08-31 13:12:15 +00:00
Dmitriy Novozhilov 39195146a9 [FIR2IR] Generate bodies of synthetic data/value class members after f/o creation 2023-08-25 14:23:41 +00:00
Dmitriy Novozhilov 76d3c0e804 [FIR2IR] Get rid of all usages of IrSymbol.owner from DataClassMembersGenerator
This change uncovered the following problem in pipeline: we have a contract,
  that all bodies will be generated after all fake overrides will be preprocessed.
  But DataClassMembersGenerator generates bodies before f/o creation,
  which leads to the problem, if data class has forward reference to some
  class which was not processed before (because in this case generator
  of `hashCode` function will try to reference f/o, which is not created yet,
  which leads to `SymbolAlreadyBound` problem)

```
data class Some(val a: A) {
    generated fun hashCode(): Int {
        return a.hashCode() // (1) is not generated yet
    }
}

class A {
    fake-override fun hashCode(): Int // (1)
}
```

This problem will be fixed in the next commit

(related test is compiler/testData/codegen/box/ir/kt52677.kt)

^KT-60924
2023-08-25 14:23:41 +00:00
Igor Yakovlev e8e8a26cd1 [Wasm] Fixed invalid delegated property getters lowering
#Fixed KT-58941
2023-07-24 18:15:16 +00:00
Svyatoslav Kuzmich a3e2d2804c [Wasm] Update testData after adding K2 and new test infra support.
- Actualize muted K2 tests
- Actualize muted K1 tests with module systems because legacy Wasm test
  infra had no respect for "// MODULE: ..." test directives
2023-06-25 10:20:40 +02:00
Vladimir Sukharev a036e41809 [Test] Convert IGNORE: NATIVE directives in box tests from D to I
^KT-59057

Merge-request: KT-MR-10748
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-23 09:11:17 +00:00
Kirill Rakhman 4dd1f9f4d6 [FIR] Set type arguments for callable reference in property delegation
#KT-58555 Fixed
2023-05-25 09:27:47 +00:00
Pavel Kunyavskiy 2f3947d8e5 [K/N] Unmute some actually passing tests 2023-05-09 09:15:41 +00:00
Denis.Zharkov 7b46c59d57 K2: Complete property-candidate before starting invoke resolution
Before this commit, for property candidates in K2 their types wasn't
inferred/susbtituted properly.

So, when candidate for fooBar.liveLoaded.invoke() was created,
the type of `fooBar.liveLoaded` was just X type parameter for which
there is no any `bar()` functions in its member scope.

While proposed semantics is a bit different from K1, where
both property and invoke candidates are united into common system,
it doesn't contradict to the specification (https://kotlinlang.org/spec/overload-resolution.html#callables-and-invoke-convention)
which says explicitly that invoke-convention should be desugared as
`r.foo.invoke()`, thus `r.foo` should be completed independently.

Also, this strategy supports some reasonable use-cases like KT-58259
while it's still a breaking change but for more artificial-looking
situations (see KT-58260) and should be passed through
the language committee.

The changes in stubTypeReceiverRestriction* tests looks consistent
because of how `genericLambda` now works
(with full completion of property call).
NB: The code is going to be red once KT-54667 is fixed and also there's
already similar diagnostic in K1 (INFERRED_INTO_DECLARED_UPPER_BOUNDS)

^KT-58142 Fixed
^KT-58259 Fixed
^KT-58260 Related
2023-04-28 12:46:20 +00:00
Dmitriy Novozhilov 7958a9debd [FIR2IR] Correctly generate delegating constructor call for secondary constructors in enums
^KT-56927 Fxied
2023-04-27 13:35:14 +00:00
Nikolay Lunyak bcfafc601e Add EnumEntries to minimal-stdlib-for-tests
This change allows to revert adding `WITH_STDLIB` directive
to tests which happened at `a9343aeb`.

Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-03-02 10:23:38 +00:00
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
Artem Kobzar 71486a321c [K/JS] Add support of compilation with ES-classes 2023-01-17 18:14:17 +00:00
Vladimir Sukharev 924898afb7 [K/N] KFC-446: K2 platform: Native alpha
Merge-request: KT-MR-7905
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-01-04 16:10:40 +00:00
Sergej Jaskiewicz 9c6f92d697 [test] Add a test for KT-55318 2022-12-13 17:01:00 +00:00
Sergej Jaskiewicz aa1b18b0c8 [IR] Prevent infinite recursion when rendering bound symbol references
Refactor the renderer, make BoundSymbolReferenceRenderer a static class
to prevent calling RenderIrElementVisitor's methods from it to avoid
infinite recursion in the future.

^KT-52677 Fixed
2022-11-28 16:43:53 +00:00
Ilya Chernikov 7e4ee399c8 FIR JS: temporarily mute remaining codegen tests 2022-11-12 16:28:25 +01: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
Ilya Chernikov 5b3816cce5 Test infra: refactor IGNORE_BACKEND directive
treat it as a general one, introduce *_K1 and *_K2 variants for
more specific ignoring
2022-11-12 16:28:23 +01:00
Mads Ager 59c2bde10a [K/N] Unmute passing tests. 2022-08-01 08:57:16 +00:00
Igor Yakovlev 0ae7e00ed8 Revert "[WASM] Remove ignore from passing tests"
This reverts commit a655f9da58.
2022-02-02 16:44:48 +03:00
Igor Yakovlev a655f9da58 [WASM] Remove ignore from passing tests 2022-01-26 23:40:42 +03:00
Igor Yakovlev ea060dcf8a [WASM] Implement lazy with UnsafeLazyImpl 2021-12-07 21:33:34 +03: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
Ilya Chernikov 81e4f3091a [minor] unmute suppress test on FIR - suppression works properly now 2021-10-27 22:17:42 +02:00
Svyatoslav Kuzmich 15acc412ba [Wasm] Update testdata after coroutines support 2021-10-12 08:42:00 +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
Roman Artemev 1d39b37c90 [IR] Add test describes case from KT-48912
It actually doesn't check behaviour because we don't have proper infra
for that but explains a bit a problem for further investigations.
2021-10-06 03:47:17 +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
Roman Artemev 38f21b7139 [JS IR] Add test to check proper type substitution 2021-10-01 23:02:24 +03:00
Roman Artemev 882016c22f [IR] Add tests for KT-47342 2021-09-30 15:42:03 +03:00
Svyatoslav Kuzmich 5c05ff48ff [Wasm] Copy property reference lowering from K/N 2021-09-27 17:07:39 +03:00
Svyatoslav Kuzmich b79719d6f5 [Wasm] Fix unit issues
- Materialize unit when its value is actually needed.
- Special-case Unit_getInstance return type at codegen. It should be a
  proper Unit object instead of a "void"
2021-09-08 19:56:26 +03:00
Roman Artemev d3ddeef67f [JS IR] Wrap private top level function with internal accessor stub
In case internal inline function references private top level function
after inline such function (T.L.P.) couldn't be referenced
in klib and IC cache. So create internally visible accessors for P.T.L.
function similar to what JVM backend does.

 - add box test
2021-08-10 19:52:08 +03:00
Dmitriy Novozhilov 5354e4afe4 [FIR] Ignore some MPP backend tests
FIR doesn't support actual declarations in same module where expect
  declarations lay
2021-07-20 10:33:50 +03:00
Mikhael Bogdanov a657e63dbb Update test affected by ForbidUsingExtensionPropertyTypeParameterInDelegate feature 2021-07-16 13:26:35 +00:00
Roman Artemev 09d30c91bf [JS TESTS] Disable mangler checker in tests 2021-07-01 17:40:41 +03:00
Roman Artemev 5a284de2d4 add tests for private signatures
regenerate tests

add test for EnumEntry's argument declarations

add another test

regenerate test

fix test a bit
2021-07-01 17:40:27 +03:00
Dmitriy Novozhilov ea2783eace [FIR] Fix generating this reference in delegated accessors
There was a problem with delegated extension property with dispatch
  receiver that `this` in `getValue` call was set to dispatch receiver
  instead of extension one
2021-02-20 18:27:43 +03:00
Mikhail Glukhikh 357a7907a3 FIR: fix type approximation by visibility 2021-02-19 10:39:57 +03:00
Dmitriy Novozhilov 7b7b8fbea7 [Test] Filter dependent modules by source kind in creating FirModuleInfo 2021-02-18 14:44:44 +03:00
Mikhael Bogdanov 0ad24f5346 Enable Android box test 2021-01-28 18:01:21 +01:00
Dmitriy Novozhilov af5a635f85 [Test] Ignore error diagnostics from FIR in some BB tests 2021-01-12 18:35:39 +03:00