[FIR] Consider the isExpect value of the receiver class for intersection overrides

It's critical for signature calculation in FIR2IR because `isExpect` is a part of signature
This commit is contained in:
Ivan Kochurkin
2023-04-21 15:50:09 +02:00
committed by Space Team
parent c7853c61b6
commit 31424e38ac
11 changed files with 247 additions and 1 deletions
@@ -0,0 +1,127 @@
Module: <common>
FILE fqName:<root> fileName:/common.kt
CLASS INTERFACE name:I1 modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.I1
FUN name:f visibility:public modality:ABSTRACT <> ($this:<root>.I1) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.I1
PROPERTY name:p visibility:public modality:ABSTRACT [val]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-p> visibility:public modality:ABSTRACT <> ($this:<root>.I1) returnType:kotlin.Int
correspondingProperty: PROPERTY name:p visibility:public modality:ABSTRACT [val]
$this: VALUE_PARAMETER name:<this> type:<root>.I1
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 [operator] 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 INTERFACE name:I2 modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.I2
FUN name:f visibility:public modality:ABSTRACT <> ($this:<root>.I2) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.I2
PROPERTY name:p visibility:public modality:ABSTRACT [val]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-p> visibility:public modality:ABSTRACT <> ($this:<root>.I2) returnType:kotlin.Int
correspondingProperty: PROPERTY name:p visibility:public modality:ABSTRACT [val]
$this: VALUE_PARAMETER name:<this> type:<root>.I2
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 [operator] 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:C modality:FINAL visibility:public [expect] superTypes:[<root>.I1; <root>.I2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary,expect]
FUN FAKE_OVERRIDE name:f visibility:public modality:ABSTRACT <> ($this:<root>.I1) returnType:kotlin.String [expect,fake_override]
overridden:
public abstract fun f (): kotlin.String declared in <root>.I1
public abstract fun f (): kotlin.String declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:<root>.I1
PROPERTY FAKE_OVERRIDE name:p visibility:public modality:ABSTRACT [expect,fake_override,val]
overridden:
public abstract p: kotlin.Int [val]
public abstract p: kotlin.Int [val]
FUN FAKE_OVERRIDE name:<get-p> visibility:public modality:ABSTRACT <> ($this:<root>.I1) returnType:kotlin.Int [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:p visibility:public modality:ABSTRACT [expect,fake_override,val]
overridden:
public abstract fun <get-p> (): kotlin.Int declared in <root>.I1
public abstract fun <get-p> (): kotlin.Int declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:<root>.I1
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [expect,fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.I1
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.I2
$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 [expect,fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.I1
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [expect,fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.I1
public open fun toString (): kotlin.String [fake_override] declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
Module: platform
FILE fqName:<root> fileName:/platform.kt
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I1; <root>.I2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I1; <root>.I2]'
FUN name:f visibility:public modality:OPEN <> ($this:<root>.C) returnType:kotlin.String
overridden:
public abstract fun f (): kotlin.String declared in <root>.I1
public abstract fun f (): kotlin.String declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:<root>.C
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun f (): kotlin.String declared in <root>.C'
CONST String type=kotlin.String value="OK"
PROPERTY name:p visibility:public modality:OPEN [val]
overridden:
public abstract p: kotlin.Int [val]
public abstract p: kotlin.Int [val]
FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=42
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-p> visibility:public modality:OPEN <> ($this:<root>.C) returnType:kotlin.Int
correspondingProperty: PROPERTY name:p visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-p> (): kotlin.Int declared in <root>.I1
public abstract fun <get-p> (): kotlin.Int declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:<root>.C
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-p> (): kotlin.Int declared in <root>.C'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.C declared in <root>.C.<get-p>' type=<root>.C origin=null
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 [fake_override,operator] declared in <root>.I1
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.I2
$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 [fake_override] declared in <root>.I1
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.I2
$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 [fake_override] declared in <root>.I1
public open fun toString (): kotlin.String [fake_override] declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -0,0 +1,29 @@
// FIR_IDENTICAL
// IGNORE_BACKEND_K1: JVM_IR, JS_IR
// !LANGUAGE: +MultiPlatformProjects
// MODULE: common
// FILE: common.kt
interface I1 {
fun f(): String
val p: Int
}
interface I2 {
fun f(): String
val p: Int
}
expect class C() : I1, I2
// MODULE: platform()()(common)
// FILE: platform.kt
actual class C : I1, I2 {
override fun f() = "OK"
override val p = 42
}
@@ -0,0 +1,44 @@
// MODULE: <common>
// FILE: common.kt
interface I1 {
abstract fun f(): String
abstract val p: Int
abstract get
}
interface I2 {
abstract fun f(): String
abstract val p: Int
abstract get
}
expect class C : I1, I2 {
expect constructor() /* primary */
}
// MODULE: platform
// FILE: platform.kt
class C : I1, I2 {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun f(): String {
return "OK"
}
override val p: Int
field = 42
override get
}