[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
This commit is contained in:
Kirill Rakhman
2024-01-17 09:59:17 +01:00
committed by Space Team
parent d80dee6e1c
commit 3b841dcb98
58 changed files with 899 additions and 530 deletions
@@ -1,26 +0,0 @@
MODULE main
CLASS A.class
K1
contains(I)Z [public, bridge]
K2
---
K1
---
K2
contains(Ljava/lang/Integer;)Z [public, bridge]
K1
indexOf(I)I [public, bridge]
K2
---
K1
---
K2
indexOf(Ljava/lang/Integer;)I [public, bridge]
K1
lastIndexOf(I)I [public, bridge]
K2
---
K1
---
K2
lastIndexOf(Ljava/lang/Integer;)I [public, bridge]
@@ -1,5 +1,4 @@
// WITH_STDLIB
// JVM_ABI_K1_K2_DIFF: KT-57300
abstract class A : AbstractMutableList<Int>()
@@ -0,0 +1,10 @@
MODULE main
CLASS Test.class
K1
getOrDefault(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; [public, final, bridge]
K2
---
K1
getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; [public, bridge]
K2
---
+1 -2
View File
@@ -1,10 +1,9 @@
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
// FIR status: different structure of fake overrides. Fixed in the IR fake override builder.
// IGNORE_BACKEND: ANDROID
// ^ NSME: java.util.AbstractMap.remove
// FULL_JDK
// JVM_ABI_K1_K2_DIFF: KT-65095
class Test : Map<String, String>, java.util.AbstractMap<String, String>() {
override val entries: MutableSet<MutableMap.MutableEntry<String, String>>
@@ -0,0 +1,10 @@
MODULE main
CLASS Test.class
K1
getOrDefault(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; [public, final, bridge]
K2
---
K1
getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; [public, bridge]
K2
---
+2 -2
View File
@@ -1,10 +1,10 @@
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
// FIR status: different structure of fake overrides. Fixed in the IR fake override builder.
// IGNORE_BACKEND: ANDROID
// ^ NSME: java.util.AbstractMap.remove
// FULL_JDK
// JVM_ABI_K1_K2_DIFF: KT-65095
interface MSS : Map<String, String>
class Test : MSS, java.util.AbstractMap<String, String>() {
@@ -0,0 +1,10 @@
MODULE main
CLASS Test.class
K1
getOrDefault(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; [public, final, bridge]
K2
---
K1
getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; [public, bridge]
K2
---
+1 -2
View File
@@ -1,10 +1,9 @@
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
// FIR status: different structure of fake overrides. Fixed in the IR fake override builder.
// IGNORE_BACKEND: ANDROID
// ^ NSME: java.util.AbstractMap.remove
// FULL_JDK
// JVM_ABI_K1_K2_DIFF: KT-65095
// FILE: kt48945b.kt
interface MSS : Map<String, String>
@@ -0,0 +1,10 @@
MODULE main
CLASS Test.class
K1
getOrDefault(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; [public, final, bridge]
K2
---
K1
getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; [public, bridge]
K2
---
+1 -2
View File
@@ -1,10 +1,9 @@
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
// FIR status: different structure of fake overrides. Fixed in the IR fake override builder.
// IGNORE_BACKEND: ANDROID
// ^ NSME: java.util.AbstractMap.remove
// FULL_JDK
// JVM_ABI_K1_K2_DIFF: KT-65095
// FILE: kt48945b.kt
interface MSS : Map<String, String>
@@ -7,30 +7,6 @@ MODULE main
public open
K2
public open operator
K1
contains(I)Z [public, bridge]
K2
---
K1
---
K2
contains(Ljava/lang/Integer;)Z [public, bridge]
K1
indexOf(I)I [public, bridge]
K2
---
K1
---
K2
indexOf(Ljava/lang/Integer;)I [public, bridge]
K1
lastIndexOf(I)I [public, bridge]
K2
---
K1
---
K2
lastIndexOf(Ljava/lang/Integer;)I [public, bridge]
CLASS D.class
CLASS METADATA
FUNCTION removeAt(I)Ljava/lang/Integer;
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// JVM_ABI_K1_K2_DIFF: KT-57300, KT-63857
// JVM_ABI_K1_K2_DIFF: KT-63857
// FILE: A.java
abstract public class A extends B {
@@ -83,14 +83,17 @@ FILE fqName:<root> fileName:/delegatedPropertyWithMultipleOverriddens_generics.k
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.MyList<E4 of <root>.MyMutableList>) returnType:E4 of <root>.MyMutableList [fake_override]
overridden:
public abstract fun foo (): E2 of <root>.MyList declared in <root>.MyList
public abstract fun foo (): E3 of <root>.MyMutableCollection declared in <root>.MyMutableCollection
$this: VALUE_PARAMETER name:<this> type:<root>.MyList<E4 of <root>.MyMutableList>
PROPERTY FAKE_OVERRIDE name:bar visibility:public modality:ABSTRACT [fake_override,val]
overridden:
public abstract bar: E2 of <root>.MyList
public abstract bar: E3 of <root>.MyMutableCollection
FUN FAKE_OVERRIDE name:<get-bar> visibility:public modality:ABSTRACT <> ($this:<root>.MyList<E4 of <root>.MyMutableList>) returnType:E4 of <root>.MyMutableList [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:bar visibility:public modality:ABSTRACT [fake_override,val]
overridden:
public abstract fun <get-bar> (): E2 of <root>.MyList declared in <root>.MyList
public abstract fun <get-bar> (): E3 of <root>.MyMutableCollection declared in <root>.MyMutableCollection
$this: VALUE_PARAMETER name:<this> type:<root>.MyList<E4 of <root>.MyMutableList>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
@@ -1,7 +1,5 @@
// ISSUE: KT-55828
// DUMP_IR
// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION: extra overridden symbols for declarations in MyMutableList.
// ^ This is most likely not a problem, and IR dump can be changed once IR fake override generation is enabled by default.
// JVM_ABI_K1_K2_DIFF: KT-63828
@@ -79,14 +79,17 @@ FILE fqName:<root> fileName:/delegatedPropertyWithMultipleOverriddens_noGenerics
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.MyList) returnType:kotlin.String [fake_override]
overridden:
public abstract fun foo (): kotlin.String declared in <root>.MyList
public abstract fun foo (): kotlin.String declared in <root>.MyMutableCollection
$this: VALUE_PARAMETER name:<this> type:<root>.MyList
PROPERTY FAKE_OVERRIDE name:bar visibility:public modality:ABSTRACT [fake_override,val]
overridden:
public abstract bar: kotlin.String
public abstract bar: kotlin.String
FUN FAKE_OVERRIDE name:<get-bar> visibility:public modality:ABSTRACT <> ($this:<root>.MyList) returnType:kotlin.String [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:bar visibility:public modality:ABSTRACT [fake_override,val]
overridden:
public abstract fun <get-bar> (): kotlin.String declared in <root>.MyList
public abstract fun <get-bar> (): kotlin.String declared in <root>.MyMutableCollection
$this: VALUE_PARAMETER name:<this> type:<root>.MyList
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
@@ -1,7 +1,5 @@
// ISSUE: KT-55828
// DUMP_IR
// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION: extra overridden symbols for declarations in MyMutableList.
// ^ This is most likely not a problem, and IR dump can be changed once IR fake override generation is enabled by default.
// JVM_ABI_K1_K2_DIFF: KT-63828
interface MyCollection {
@@ -1,13 +0,0 @@
MODULE main
CLASS MyMap.class
METHOD getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
Annotation: method.invisibleAnnotations
K1
@Lkotlin/SinceKotlin;( version: 1.1 )
K2
---
Annotation: method.invisibleAnnotations
K1
@Lkotlin/internal/PlatformDependent;
K2
---
@@ -3,7 +3,6 @@
// TARGET_BACKEND: JVM
// WITH_STDLIB
// FULL_JDK
// JVM_ABI_K1_K2_DIFF: KT-62788
// FILE: main.kt
var result = ""
@@ -1,6 +1,3 @@
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57299 K2: VerifyError due to overriding final method `size` on a subclass of Collection and Set
abstract class AC<X> : Collection<X>
abstract class ASet<T> : AC<T>(), Set<T>
@@ -1,8 +1,5 @@
// WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57300 K2: subclass of MutableCollection with primitive element type has methods with boxed type
abstract class AIterD : AbstractIterator<Double>()
abstract class ACollD : AbstractCollection<Double>()
@@ -1,9 +1,5 @@
// WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57300 K2: subclass of MutableCollection with primitive element type has methods with boxed type
// (`containsValue(Ljava/lang/Double;)Z` instead of `containsValue(D)Z`)
abstract class AMapSD : AbstractMap<String, Double>()
abstract class AMMapSD : AbstractMutableMap<String, Double>()
@@ -1,8 +1,5 @@
// WITH_STDLIB
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57300 K2: subclass of MutableCollection with primitive element type has methods with boxed type
abstract class AMListD : AbstractMutableList<Double>()
abstract class AMListI : AbstractMutableList<Int>()