[Tests] Add test for already fixed KT-60847

^KT-60847 Fixed
This commit is contained in:
Pavel Kunyavskiy
2024-02-29 14:39:40 +01:00
committed by Space Team
parent 80f4994122
commit 807d352ed4
12 changed files with 212 additions and 0 deletions
@@ -0,0 +1,118 @@
FILE fqName:<root> fileName:/common.kt
CLASS CLASS name:Derived modality:ABSTRACT visibility:public superTypes:[<root>.Base; <root>.OtherBase]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Derived
CONSTRUCTOR visibility:public <> () returnType:<root>.Derived [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived modality:ABSTRACT visibility:public superTypes:[<root>.Base; <root>.OtherBase]'
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>.Base
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.OtherBase
$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>.Base
public open fun hashCode (): kotlin.Int declared in <root>.OtherBase
$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>.OtherBase
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.Derived, e:kotlin.String) returnType:kotlin.String
overridden:
public abstract fun foo (e: kotlin.String): kotlin.String declared in <root>.Base
public abstract fun foo (e: kotlin.String): kotlin.String declared in <root>.OtherBase
$this: VALUE_PARAMETER name:<this> type:<root>.Derived
VALUE_PARAMETER name:e index:0 type:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun foo (e: kotlin.String): kotlin.String declared in <root>.Derived'
GET_VAR 'e: kotlin.String declared in <root>.Derived.foo' type=kotlin.String origin=null
CLASS INTERFACE name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<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 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
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.Base, e:kotlin.String) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.Base
VALUE_PARAMETER name:e index:0 type:kotlin.String
CLASS INTERFACE name:OtherBase modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.OtherBase
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
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.OtherBase, e:kotlin.String) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.OtherBase
VALUE_PARAMETER name:e index:0 type:kotlin.String
FUN name:bar visibility:public modality:FINAL <> (d:<root>.Derived, e:kotlin.String, f:kotlin.String) returnType:kotlin.String
VALUE_PARAMETER name:d index:0 type:<root>.Derived
VALUE_PARAMETER name:e index:1 type:kotlin.String
VALUE_PARAMETER name:f index:2 type:kotlin.String
BLOCK_BODY
VAR name:a type:kotlin.String [val]
CALL 'public open fun foo (e: kotlin.String): kotlin.String declared in <root>.Derived' type=kotlin.String origin=null
$this: GET_VAR 'd: <root>.Derived declared in <root>.bar' type=<root>.Derived origin=null
e: GET_VAR 'e: kotlin.String declared in <root>.bar' type=kotlin.String origin=null
VAR name:b type:kotlin.String [val]
CALL 'public open fun foo (e: kotlin.String): kotlin.String declared in <root>.Derived' type=kotlin.String origin=null
$this: GET_VAR 'd: <root>.Derived declared in <root>.bar' type=<root>.Derived origin=null
e: GET_VAR 'f: kotlin.String declared in <root>.bar' type=kotlin.String origin=null
RETURN type=kotlin.Nothing from='public final fun bar (d: <root>.Derived, e: kotlin.String, f: kotlin.String): kotlin.String declared in <root>'
STRING_CONCATENATION type=kotlin.String
GET_VAR 'val a: kotlin.String declared in <root>.bar' type=kotlin.String origin=null
GET_VAR 'val b: kotlin.String declared in <root>.bar' type=kotlin.String origin=null
FILE fqName:<root> fileName:/jvm.kt
CLASS CLASS name:Platform modality:FINAL visibility:public superTypes:[<root>.Derived]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Platform
CONSTRUCTOR visibility:public <> () returnType:<root>.Platform [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Derived'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Platform modality:FINAL visibility:public superTypes:[<root>.Derived]'
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>.Derived
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Derived, e:kotlin.String) returnType:kotlin.String [fake_override]
overridden:
public open fun foo (e: kotlin.String): kotlin.String declared in <root>.Derived
$this: VALUE_PARAMETER name:<this> type:<root>.Derived
VALUE_PARAMETER name:e index:0 type:kotlin.String
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>.Derived
$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>.Derived
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CALL 'public final fun bar (d: <root>.Derived, e: kotlin.String, f: kotlin.String): kotlin.String declared in <root>' type=kotlin.String origin=null
d: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Platform' type=<root>.Platform origin=null
e: CONST String type=kotlin.String value="O"
f: CONST String type=kotlin.String value="K"
TYPEALIAS name:Expect visibility:public expandedType:kotlin.String[actual]
@@ -0,0 +1,34 @@
// !LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND_K1: ANY
// IGNORE_CODEGEN_WITH_FIR2IR_FAKE_OVERRIDE_GENERATION: JVM_IR
// DUMP_IR
// MODULE: common
// FILE: common.kt
expect class Expect
interface OtherBase {
fun foo(e: Expect): Expect
}
interface Base {
fun foo(e: String): String
}
abstract class Derived: Base, OtherBase {
override fun foo(e: Expect) = e
}
fun bar(d: Derived, e : String, f: Expect) : String {
val a = d.foo(e)
val b = d.foo(f)
return "$a$b"
}
// MODULE: jvm()()(common)
// FILE: jvm.kt
class Platform : Derived()
actual typealias Expect = String
fun box() : String {
return bar(Platform(), "O", "K")
}