Commit Graph

83 Commits

Author SHA1 Message Date
Mikhail Glukhikh 672b5ba0d7 K2/Java: implement platform-dependent function filtering in JvmMappedScope
We drop Kotlin function 'remove' or 'getOrDefault' from JvmMappedScope,
if it has platform-dependent annotation, and the bound Java class scope
does not contain a function with the same signature.

#KT-57268 Fixed
2024-01-30 19:44:00 +00:00
vladislav.grechko 34bac48541 Add JVM ABI K1/K2 consistency tests 2023-12-26 10:18:19 +00:00
Alexander Udalov 953f6ba6b6 K2: keep FlexibleNullability on enhanced type parameter types
Types based on type parameters which have both hasEnhancedNullability
and hasFlexibleNullability were incorrectly converted to IR: only
`@EnhancedNullability` annotation was added to the IR type. This means
that the nullability of the type started to matter, which is incorrect
because the type is supposed to be flexible.

This backfired in the IR fake override builder mode, where nullability
of methods inherited from both Kotlin maps and Java maps clashed, which
resulted in the exception from FakeOverrideRebuilder.

If the type is both flexible and enhanced, we're now adding
`@FlexibleNullability` to the IR type. Note that `@EnhancedNullability`
is not needed because it only affects primitive types which need to be
handled as wrapper types on JVM, but `@FlexibleNullability` already has
that effect.

IR still slightly differs from K1 for collection subclasses, which can
be seen for example in the changed IR text tests. This is to be
investigated later.

The change in tests is needed because the `kt48495*.kt` tests are now
passing on K2 in the IR fake override builder mode, while failing on the
vanilla K2.

This is related to KT-61370 but does not entirely fix it, although
curiously it fixes all remaining tests which were muted because of it.
2023-11-09 09:13:28 +00:00
Pavel Kunyavskiy 91e96e9f31 [Fir2Ir] Introduce testing with IrFakeOverrideBuilder
^KT-61514
2023-08-31 13:12:15 +00:00
vladislav.grechko e9ccc0329c Fix isKotlinFunctionWithBigArity function
fixup! Fix `isKotlinFunctionWithBigArity` function

Fix `isKotlinFunctionWithBigArity` function

Previous implementation could return false positive results, e.g. for
class named `abacaba.kotlin.Function42`

^KT-61548: Fixed


Merge-request: KT-MR-11928
Merged-by: Vladislav Grechko <Vladislav.Grechko@jetbrains.com>
2023-08-30 09:15:00 +00:00
Vladimir Sukharev 3d60ed8874 [Test] Convert IGNORE: NATIVE directives in box tests from A to C
^KT-59057

Merge-request: KT-MR-10747
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-22 08:39:20 +00:00
Alexander Korepanov fc898c7620 [JS IR] Use type upper bounds for calculating function signatures
^KT-59239 Fixed
2023-06-14 14:57:15 +00:00
Alexander Udalov 3120a35a88 JvmDefault: remove most tests on @JvmDefault
The tests are removed because JvmDefault is going to be deprecated with
error in KT-54746 and removed later in KT-57696.

Many of the removed tests already had existing counterparts with the new
modes `all` and `all-compatibility`. In this change, I've added such
tests where they were missing, and removed tests which were testing
behavior specific to the JvmDefault annotation, such as some
diagnostics.

 #KT-54746
2023-04-25 14:33:00 +00:00
Mikhail Glukhikh 76ff717091 FIR2IR: don't create non-lazy fake overrides inside lazy class
This commit allows to calculate member with initial signature properly.
Only lazy IR members are suitable to calculate initial signature.
Before this commit we sometimes built non-lazy children for lazy class.
Now we build lazy children (with an exception of private declarations).
2022-02-16 09:24:12 +00:00
Pavel Punegov 49b6545268 [K/N][test] Ignore test that extends final ArrayList (in K/N) 2022-01-13 08:31:09 +00:00
Dmitry Petrov 5946242d75 JVM_IR fix special bridges in mixed Java/Kotlin hierarchies
KT-50257 KT-50476
2021-12-29 13:29:19 +00:00
Dmitry Petrov 8c71e38c92 JVM_IR KT-49765 bridge for throwing stub should just throw UOE 2021-12-16 21:07:12 +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
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
Denis.Zharkov c3a327e118 FIR: Fix ambiguity on Int2IntMap in IC 2021-08-17 21:38:01 +03:00
Ilya Chernikov 8f5d5c3ace FIR: Fixes in testdata after implementing FIR-specific IrBuiltIns 2021-07-16 02:24:29 +03:00
Andrey Zinovyev 64b45e6d1b Add comments to skipped FIR tests 2021-05-25 19:23:30 +03:00
Dmitriy Novozhilov af79265f42 [FIR] Fix creating overrides for functions with name same as renamed in JVM builtins 2021-03-02 19:11:15 +03:00
Denis.Zharkov a750d9466e FIR2IR: Rework resulted overridden-relation structure
The difference is how we deal with intermediate fake overrides
E.g., in case

interface A { /* $1 */ fun foo() }
interface B : A {
     /* $2 */ fake_override fun foo()
}
interface C : B {
   /* $3 */ override fun foo()
}

We've got FIR declarations only for $1 and $3, but we've got
a fake override for $2 in IR.

Previously, override $3 had $1 as its overridden IR symbol, just because
FIR declaration of $3 doesn't know anything about $2.

Now, when generating IR for $2, we save the necessary information
and using it for $3, so it has $2 as overridden.

So, it's consistent with the overridden structure of FE 1.0 and this
structure is necessary prerequisite for proper building of bridges
for special built-ins.
2021-02-20 10:59:22 +03:00
Svyatoslav Kuzmich fdd7fa5aea [Wasm] Mute codegen box tests 2020-11-09 16:04:43 +03:00
Mikhail Glukhikh 09043fb98d [FIR] JvmMappedScope: add mutable methods or not depending on a class 2020-10-27 10:27:06 +03:00
Mikhail Glukhikh d3e85dbce0 [FIR] Implement replacing Object with type parameters for specials builtins
#KT-42601 Fixed
2020-10-23 08:12:15 +03:00
Denis Zharkov 3dfbd36f15 FIR: Unmute passing blackbox tests 2020-10-01 17:49:02 +03:00
Dmitry Petrov 0539b2b389 Mute some FIR->JVM_IR box tests
FIR generates delegated class members incorrectly (with non-substituted
signatures).
2020-09-22 16:32:27 +03:00
Mikhail Glukhikh f1356a809e Fir2IrLazySimpleFunction: generate overridden symbols via FirTypeScope 2020-08-05 12:11:33 +03:00
Mikhail Glukhikh 1bbed6c4ed [FIR2IR] Use FIR-specific methods to search for overridden functions 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh b6cdcc8d50 [FIR2IR] Mute 2 failing BB tests 2020-05-28 22:51:20 +03:00
Mikhail Glukhikh 85760770a8 [FIR2IR] Initialize built-in symbols at start of conversion 2020-05-28 22:18:20 +03:00
Mikhail Glukhikh cd24745f1f [FIR2IR] Add primitive signature composer & use it for external classes 2020-05-28 22:18:13 +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
Jinseong Jeon eac9af521e [FIR2IR] differentiate external Java stub origin from external stub 2020-05-08 17:45:39 +03:00
Steven Schäfer 07737f8fc6 JVM IR: Fix BridgeLowering 2020-02-07 18:44:50 +03:00
Mikhail Zarechenskiy 5c5635ce20 Fix codegen & bytecode tests after unifying exceptions in JVM backend
See KT-22275 for details
2020-01-20 16:36:03 +03:00
Mark Punzalan 5afab1ac2b [FIR] FIR2IR: Populate calls with type arguments and function type
parameters with bounds/supertypes.
2019-11-25 09:37:47 +03:00
Mads Ager 15ed342282 JVM_IR: Generate args check in existing methods for special bridge methods.
Fix the number of arguments checked (1 for getOrDefault and 2 for
remove).
2019-11-19 19:10:04 +03:00
Mark Punzalan 9df2f69f09 [FIR] Disable failing blackbox codegen tests for FIR. 2019-11-19 11:00:09 +03:00
Alexander Udalov 2baddb029c Use Intrinsics.checkNotNullParameter to throw NPE in parameter null checks
Similarly to previous commits, this method was unused, so we're changing
its semantics in API version >= 1.4.

 #KT-22275 In Progress
2019-08-12 16:09:23 +02:00
pyos 6b2d874ccc JVM_IR: generate non-null assertions for arguments 2019-05-21 18:30:27 +03:00
Jiaxiang Chen afcbd76c9e Implement stub methods generation for Kotlin Immutable Collection classes.
This change is to fill the gap between Kotlin Collection
classes(immutable) and Java Collection classes(mutable), to avoid
calling an unsupported operation like remove() on an immutable class in
jvm.
2019-05-21 17:20:20 +03:00
Dmitry Petrov 8be7f7f1f7 IR: Make sure that symbols refer to original descriptors only
If a descriptor is a WrappedDeclarationDescriptor, it SHOULD NOT be
substituted.
2019-03-29 16:00:56 +03:00
Svyatoslav Kuzmich aa811dcfb3 [JS IR BE] Add KJS_WITH_FULL_RUNTIME directive to compiler tests 2019-01-24 16:14:40 +03:00
Mikhael Bogdanov f59b6a350f Specify JVM target backend for other java related tests 2018-12-21 16:09:11 +01:00
Mikhael Bogdanov a8a1bfca72 Specify JVM target backend for test with '// File: *.java' 2018-12-21 16:09:06 +01:00
Alexander Udalov e3c381a298 Remove API_VERSION 1.3 from tests on JvmDefault
So that these tests will now check behavior on the latest API version
2018-12-20 12:53:23 +01:00
Mikhael Bogdanov a4206a543a Skip test on JDK 6 2018-10-22 16:32:55 +02:00
Mikhael Bogdanov 5b8acd69e3 Mute JVM IR tests 2018-10-22 16:32:53 +02:00
Mikhael Bogdanov ac8e1a0124 Move JVM8 box test to common 2018-10-22 16:32:52 +02:00
Anton Bannykh 995ac7aac2 [JS IR BE]: make deleteProperty non-inline due to new inliner limitations 2018-10-18 14:24:05 +03:00
Anton Bannykh 2e709a81fa [JS IR BE] Arrays, varargs 2018-09-18 14:36:20 +03:00