Commit Graph

244 Commits

Author SHA1 Message Date
Pavel Kunyavskiy e6f4d6e6fa [Tests] Use stable order for ir/kotlinLike dumps
^KT-65406
2024-02-16 10:19:38 +00:00
Kirill Rakhman 3b841dcb98 [FIR] Don't remove subsumed members from intersection overrides's overriddens
This fixes a bunch of missing overridden symbols in IR.
This is also required for fixing KT-59921 in the following commit
where we need to keep all overridden symbols of intersection overrides
so that we can enhance them properly.

#KT-57300 Fixed
#KT-57299 Fixed
#KT-59921
#KT-57300
#KT-62788
#KT-64271
#KT-64382
2024-01-31 11:16:50 +00:00
vladislav.grechko 34bac48541 Add JVM ABI K1/K2 consistency tests 2023-12-26 10:18:19 +00:00
Dmitriy Novozhilov 94c46d384a [FIR2IR] Properly calculate the type of delegated function call
```
interface A {
    fun <T> foo(): T
}

class B(val a: A) : A by A {
    generated fun <T'> foo(): T' {
        return a.foo() // <------
    }
}
```

There was a problem that type of generated delegated call used
  an unsubstituted type of the original delegated declaration, which led
  to a situation when (see example) type of call `a.foo()` was not `T'`
  but `T`, which led to incorrect IR and further exceptions on backend

^KT-64257 Fixed
^KT-64284 Obsolete
2023-12-18 12:45:28 +00:00
Svyatoslav Kuzmich 76e132e758 [Wasm] Fix overloading virtual methods by vararg and array element type
Context:
- Kotlin allows functions overloaded with different array element types.
- Varargs are lowered to Array parameters.
- Before this commit, K/Wasm erased an array element type
  from the signature, similar to type argument erasure in other cases.

Fix:
Stop erasing type arguments in arrays when computing v-table signatures.

^KT-58852 Fixed
2023-12-13 13:30:50 +00:00
Dmitriy Novozhilov 4272f2e156 [FIR] Process all overridden members from intersection scopes
Previously, there was a contract that each callable symbol in the chain
  of `processDirectOverriddenWithBaseScope` will be unique. And if some
  symbol is accessible from multiple scopes, then only last of them will
  be returned as a component of `MemberWithScope`

But after the change from previous commit, we don't have this contract anymore.
  Which means that we may meet the same symbol during processing hierarchy
  of overridden functions (but with different base scopes)

So if some code utilizes `process...Overridden...WithBaseScope` functions
  it should consider that the same symbol may be obtained several times

^KT-63738 Fixed
2023-12-08 15:19:55 +00:00
Dmitriy Novozhilov a15057b2ca [FIR2IR] Unwrap only call-site overrides during delegated members generation
^KT-60251 Fixed
2023-12-08 15:19:55 +00:00
Dmitriy Novozhilov 3d6ec0ec75 [FIR2IR] Automatically store IR declaration in its parent upon creation
Previously, creating a declaration with Fir2IrCallableDeclarationsGenerator/
  Fir2IrClassifiersGenerator didn't guarantee that this declaration will
  be actually added to the list of parent class/file declarations, which
  lead to situations when FIR2IR created some declarations in the air
  (mostly fake-overrides)
2023-10-17 12:46:27 +00:00
Alexander Udalov 8e7e24cc31 Remove reference to fixed issue in test data
These two tests are now failing with IR fake override builder because
e.g. the fake override `MyMutableList.foo` has two overridden symbols:
`MyList.foo` and `MyMutableCollection.foo`, as opposed to the normal K2
mode which only has the former.

This seems to only affect the printed IR dump. Note that in K1 there
were two overridden symbols as well.
2023-10-05 12:37:55 +00:00
Pavel Kunyavskiy 91e96e9f31 [Fir2Ir] Introduce testing with IrFakeOverrideBuilder
^KT-61514
2023-08-31 13:12:15 +00:00
Dmitriy Novozhilov d4f55894b4 [FIR2IR] Properly calculate dispatch receiver type for fake overrides
If some function is not fake-override, then its type should be just
  default type of containing class
For fake overrides the default type calculated in the following way:
1. Find first overridden function, which is not fake override
2. Take its containing class
3. Find supertype of current containing class with type constructor of
   class from step 2

^KT-60252 Fixed
2023-08-25 21:06:15 +00:00
Artem Kobzar 08bd0d6ce1 [K/JS] Generate tests for K2 + ES-classes compilation 2023-08-01 09:16:20 +00: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
Sergej Jaskiewicz fd76a34277 [IR] Don't print flags in declaration references in irText tests
This doesn't reduce the quality of tests, because the flags are still
printed for declarations themselves. We only omit them in references.

However, this makes the tests more compatible with non-JVM backends
(see KT-58605), because flags of referenced stdlib declarations may
differ among target platforms.
2023-05-30 17:26:30 +00:00
Alexander Udalov cd9209a7ee JVM: enable -Xlambdas=class in some codegen tests
Most of these tests check the specific structure of lambdas when they
are generated as classes, and they start to fail once invokedynamic
lambdas are enabled by default.
2023-04-28 21:34:19 +00:00
Kirill Rakhman e80b4c530d [FIR2IR] Properly handle intersection types in interface delegation
The changes to the irText test data result in the fact that we
now unconditionally unwrap substitution overrides of delegation targets
whereas before we built an unsubstituted scope of the type we delegate
to. If we delegate to a class A : B<C>, the unsubstituted scope of
A can still contain substitution overrides for inherited generic methods
from B<T> that we didn't unwrap before but do unwrap now.

#KT-57899 Fixed
2023-04-20 08:12:55 +00:00
Dmitriy Novozhilov ca2492e1f8 [FIR2IR] Unwrap substitution overrides during generation of delegated members
^KT-55828 Fixed
2023-03-17 12:37:33 +00:00
Nikolay Lunyak 4cf8d9ffb9 [FIR JS] Implement FirJsInheritanceChecker 2023-01-09 08:57:10 +00:00
Xin Wang 7278f9a4fd JVM Inline: Update tryCatchBlocks when expand mask conditions
Fixes: KT-48989
2022-12-22 12:50:41 +00:00
Svyatoslav Kuzmich 78bd6dbdcd [Wasm] Allow implementing function interfaces 2022-11-14 11:23:18 +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
Pavel Mikhailovskii 846537b367 KT-45375 Lightweight lambdas; KT-52817 introduce @JvmSerializableLambda 2022-07-18 17:10:07 +02: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 9f8387c76a [FIR] Fix 1.(fun Int.() = 1)() call fir conversion 2021-12-09 12:31:23 +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
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
Ivan Kochurkin 6c7c1a7a0d [FIR] Convert REDUNDANT_MODIFIER, DEPRECATED_MODIFIER_PAIR to warnings ^KT-49073 Fixed 2021-10-08 18:52:18 +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 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 a2bfcfeae8 [Wasm] Do not erase interfaces down to Any type in Wasm signature.
This enables overloading virtual methods with different interface types
2021-09-22 19:49:44 +03:00
Igor Yakovlev 41a69ad388 [WASM] Add receiver capturing to callable references 2021-09-20 19:08:22 +03:00
Igor Laevsky 00f61978b8 WASM: Enable exception handling tests 2021-09-08 19:56:38 +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
Victor Petukhov 1966915e92 Create DONT_CARE type only for dependent lambdas (i.e. to be resolved through the type inference later)
^KT-47493 Fixed
2021-08-06 13:27:56 +03:00
Dmitriy Novozhilov b9c549803d [Test] Replace public fun box() with fun box() in all box tests 2021-08-01 22:23:40 +03:00
Dmitriy Novozhilov ae608ea67f [FE 1.0] Always create return value for CallInstruction
This fixes missing `USED_AS_EXPRESSION` recordings
^KT-47527 Fixed
2021-07-02 17:55:20 +03:00
Dmitry Petrov 1298ba431b JVM_IR KT-47449 handle star projection arguments in default lambda types 2021-06-25 20:42:22 +03:00
Dmitry Petrov 851980e36f JVM_IR KT-45103 optimize direct invoke for lambdas and callable refs 2021-05-18 22:20:12 +03:00
Dmitriy Novozhilov 22cbb8720a [FIR] Fix computing labels of anonymous functions (not lambdas) 2021-04-06 12:30:38 +03:00
Georgy Bronnikov 3a10ea4f88 JVM_IR: synchronize code generation for inline functions 2021-03-16 19:49:29 +03:00
Alexander Udalov 401f0ac583 Use TARGET_BACKEND instead of DONT_TARGET_EXACT_BACKEND in box against Java tests
"// TARGET_BACKEND: JVM" more clearly says that the test is
JVM-specific, rather than DONT_TARGET_EXACT_BACKEND which excludes all
other backends.
2021-02-11 13:50:08 +01:00
Dmitriy Novozhilov 29b96aa15d [Test] Properly merge box against java testdata into codegen/box
Previous commit about it was 3199ce03 and it was completely wrong
2021-02-04 10:53:50 +03:00
Mikhael Bogdanov 1ea4fa4464 Fix android test with type annotations. Remove obsolete JVM 8 flavors
Remove some new test cause their originals would be executed on JvmTarget6OnJvm8
2021-02-02 14:32:50 +01:00
Alexander Udalov d022bb0248 Switch default JVM target to 1.8
#KT-29405 Fixed
2021-02-01 11:54:04 +01:00
Mikhael Bogdanov be9ef8f3c8 Remove obsolete DxChecker 2021-01-29 17:47:37 +01:00
Dmitriy Novozhilov af5a635f85 [Test] Ignore error diagnostics from FIR in some BB tests 2021-01-12 18:35:39 +03:00
Dmitry Petrov ae8abd1832 Minor: ignore nestedBigArityFunCalls.kt in WASM 2020-12-01 19:43:52 +03:00
Dmitry Petrov 4c3ffc3451 JVM_IR KT-41911 process big arity 'invoke' arguments recursively 2020-12-01 19:43:51 +03:00