[K/N, K/JS, K/WASM] Enable FakeOverrideRebuilder by default

While not beeing final solution, this is closer to what
we want to have in the end. Enabling on non-JVM targets
would help better testing.

Enabling in JVM is now not possible yet, as some of the bugs are
not fixed yet (check KT-61360 for details)

^KT-62476
This commit is contained in:
Pavel Kunyavskiy
2023-12-12 13:42:36 +01:00
committed by Space Team
parent c6e32571d6
commit f45d92eebc
29 changed files with 304 additions and 637 deletions
@@ -84,7 +84,8 @@ FILE fqName:<root> fileName:/delegationInSealed.kt
c: GET_VAR 'c: kotlin.CharSequence declared in <root>.A.B.copy' type=kotlin.CharSequence origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.A.B) returnType:kotlin.String
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
public open fun toString (): kotlin.String declared in <root>.A
public open fun toString (): kotlin.String declared in kotlin.CharSequence
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.A.B'
@@ -96,7 +97,8 @@ FILE fqName:<root> fileName:/delegationInSealed.kt
CONST String type=kotlin.String value=")"
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.A.B) returnType:kotlin.Int
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
public open fun hashCode (): kotlin.Int declared in <root>.A
public open fun hashCode (): kotlin.Int declared in kotlin.CharSequence
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.A.B'
@@ -105,7 +107,8 @@ FILE fqName:<root> fileName:/delegationInSealed.kt
receiver: GET_VAR '<this>: <root>.A.B declared in <root>.A.B.hashCode' type=<root>.A.B origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.A.B, other:kotlin.Any?) returnType:kotlin.Boolean [operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.A
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.CharSequence
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
BLOCK_BODY
@@ -2,6 +2,10 @@
// SKIP_KLIB_TEST
// IGNORE_BACKEND_K1: JS_IR
// KT-64271
// IGNORE_BACKEND_K2: JVM_IR
sealed class A : CharSequence {
data class B(val c: CharSequence) : A(), CharSequence by c
}
@@ -1,3 +1,6 @@
// KT-64271, KT-64382
// IGNORE_BACKEND_K2: NATIVE, WASM, JS_IR, JS_IR_ES6
enum class TestFinalEnum1 {
X1
}
@@ -0,0 +1,84 @@
FILE fqName:<root> fileName:/overriddenEquals.kt
CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Base
CONSTRUCTOR visibility:public <> () returnType:<root>.Base [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]'
FUN name:equals visibility:public modality:OPEN <> ($this:<root>.Base, other:kotlin.Any?) returnType:kotlin.Boolean [operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Base
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Base'
CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ
arg0: GET_VAR '<this>: <root>.Base declared in <root>.Base.equals' type=<root>.Base origin=null
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.Base.equals' type=kotlin.Any? origin=null
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:I modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.I
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:Child1 modality:FINAL visibility:public superTypes:[<root>.Base; <root>.I]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Child1
CONSTRUCTOR visibility:public <> () returnType:<root>.Child1 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Base'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Child1 modality:FINAL visibility:public superTypes:[<root>.Base; <root>.I]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<root>.Base, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Base
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.I
$this: VALUE_PARAMETER name:<this> type:<root>.Base
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in <root>.Base
public open fun hashCode (): kotlin.Int declared in <root>.I
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in <root>.Base
public open fun toString (): kotlin.String declared in <root>.I
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:Child2 modality:FINAL visibility:public superTypes:[<root>.I; <root>.Base]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Child2
CONSTRUCTOR visibility:public <> () returnType:<root>.Child2 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Base'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Child2 modality:FINAL visibility:public superTypes:[<root>.I; <root>.Base]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.I
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Base
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in <root>.I
public open fun hashCode (): kotlin.Int declared in <root>.Base
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in <root>.I
public open fun toString (): kotlin.String declared in <root>.Base
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
+16
View File
@@ -0,0 +1,16 @@
// FIR_IDENTICAL
// KT-64271
// IGNORE_BACKEND_K2: JVM_IR
open class Base {
override fun equals(other: Any?): Boolean {
return this === other
}
}
interface I {
}
class Child1 : Base(), I
class Child2 : I, Base()
@@ -0,0 +1,33 @@
open class Base {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override operator fun equals(other: Any?): Boolean {
return EQEQEQ(arg0 = <this>, arg1 = other)
}
}
interface I {
}
class Child1 : Base, I {
constructor() /* primary */ {
super/*Base*/()
/* <init>() */
}
}
class Child2 : I, Base {
constructor() /* primary */ {
super/*Base*/()
/* <init>() */
}
}
@@ -0,0 +1,72 @@
// CHECK:
// Mangled name: Base
// Public signature: /Base|null[0]
open class Base {
// CHECK:
// Mangled name: Base#<init>(){}
// Public signature: /Base.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: Base#equals(kotlin.Any?){}kotlin.Boolean
// Public signature: /Base.equals|722809408929142791[0]
// Public signature debug description: equals(kotlin.Any?){}kotlin.Boolean
// CHECK JS_IR NATIVE:
// Mangled name: Base#equals(kotlin.Any?){}
// Public signature: /Base.equals|4638265728071529943[0]
// Public signature debug description: equals(kotlin.Any?){}
override operator fun equals(other: Any?): Boolean
}
// CHECK:
// Mangled name: Child1
// Public signature: /Child1|null[0]
class Child1 : Base, I {
// CHECK:
// Mangled name: Child1#<init>(){}
// Public signature: /Child1.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: Child1#equals(kotlin.Any?){}kotlin.Boolean
// Public signature: /Child1.equals|722809408929142791[0]
// Public signature debug description: equals(kotlin.Any?){}kotlin.Boolean
// CHECK JS_IR NATIVE:
// Mangled name: Child1#equals(kotlin.Any?){}
// Public signature: /Child1.equals|4638265728071529943[0]
// Public signature debug description: equals(kotlin.Any?){}
/* fake */ override operator fun equals(other: Any?): Boolean
}
// CHECK:
// Mangled name: Child2
// Public signature: /Child2|null[0]
class Child2 : Base, I {
// CHECK:
// Mangled name: Child2#<init>(){}
// Public signature: /Child2.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: Child2#equals(kotlin.Any?){}kotlin.Boolean
// Public signature: /Child2.equals|722809408929142791[0]
// Public signature debug description: equals(kotlin.Any?){}kotlin.Boolean
// CHECK JS_IR NATIVE:
// Mangled name: Child2#equals(kotlin.Any?){}
// Public signature: /Child2.equals|4638265728071529943[0]
// Public signature debug description: equals(kotlin.Any?){}
/* fake */ override operator fun equals(other: Any?): Boolean
}
// CHECK:
// Mangled name: I
// Public signature: /I|null[0]
interface I {
}