[Tests] Add IR text tests for KT-57105

This commit is contained in:
Kirill Rakhman
2023-03-08 17:36:29 +01:00
committed by Space Team
parent 6964121c15
commit 2706e5502f
9 changed files with 209 additions and 0 deletions
@@ -304,6 +304,12 @@ public class FirLightTreeIrTextTestGenerated extends AbstractFirLightTreeIrTextT
runTest("compiler/testData/ir/irText/classes/secondaryConstructors.kt");
}
@Test
@TestMetadata("smartCastInValInitialization.kt")
public void testSmartCastInValInitialization() throws Exception {
runTest("compiler/testData/ir/irText/classes/smartCastInValInitialization.kt");
}
@Test
@TestMetadata("superCalls.kt")
public void testSuperCalls() throws Exception {
@@ -304,6 +304,12 @@ public class FirPsiIrTextTestGenerated extends AbstractFirPsiIrTextTest {
runTest("compiler/testData/ir/irText/classes/secondaryConstructors.kt");
}
@Test
@TestMetadata("smartCastInValInitialization.kt")
public void testSmartCastInValInitialization() throws Exception {
runTest("compiler/testData/ir/irText/classes/smartCastInValInitialization.kt");
}
@Test
@TestMetadata("superCalls.kt")
public void testSuperCalls() throws Exception {
@@ -0,0 +1,62 @@
FILE fqName:<root> fileName:/smartCastInValInitialization.kt
CLASS CLASS name:RootBus modality:FINAL visibility:public superTypes:[<root>.MessageBusImpl]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.RootBus
CONSTRUCTOR visibility:public <> () returnType:<root>.RootBus [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.MessageBusImpl'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:RootBus modality:FINAL visibility:public superTypes:[<root>.MessageBusImpl]'
PROPERTY FAKE_OVERRIDE name:parentBus visibility:public modality:FINAL [fake_override,val]
overridden:
public final parentBus: kotlin.Any? [val]
FUN FAKE_OVERRIDE name:<get-parentBus> visibility:public modality:FINAL <> ($this:<root>.MessageBusImpl) returnType:kotlin.Any? [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:parentBus visibility:public modality:FINAL [fake_override,val]
overridden:
public final fun <get-parentBus> (): kotlin.Any? declared in <root>.MessageBusImpl
$this: VALUE_PARAMETER name:<this> type:<root>.MessageBusImpl
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>.MessageBusImpl
$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>.MessageBusImpl
$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>.MessageBusImpl
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:MessageBusImpl modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MessageBusImpl
CONSTRUCTOR visibility:public <> () returnType:<root>.MessageBusImpl [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MessageBusImpl modality:OPEN visibility:public superTypes:[kotlin.Any]'
PROPERTY name:parentBus visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:parentBus type:kotlin.Any? visibility:private [final]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-parentBus> visibility:public modality:FINAL <> ($this:<root>.MessageBusImpl) returnType:kotlin.Any?
correspondingProperty: PROPERTY name:parentBus visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.MessageBusImpl
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-parentBus> (): kotlin.Any? declared in <root>.MessageBusImpl'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:parentBus type:kotlin.Any? visibility:private [final]' type=kotlin.Any? origin=null
receiver: GET_VAR '<this>: <root>.MessageBusImpl declared in <root>.MessageBusImpl.<get-parentBus>' type=<root>.MessageBusImpl origin=null
ANONYMOUS_INITIALIZER isStatic=false
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
TYPE_OP type=<root>.RootBus origin=CAST typeOperand=<root>.RootBus
GET_VAR '<this>: <root>.MessageBusImpl declared in <root>.MessageBusImpl' type=<root>.MessageBusImpl origin=null
ERROR_CALL 'Unresolved reference: R|/MessageBusImpl.parentBus|' type=IrErrorType(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 [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
@@ -0,0 +1,25 @@
class RootBus : MessageBusImpl {
constructor() /* primary */ {
super/*MessageBusImpl*/()
/* <init>() */
}
}
open class MessageBusImpl {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
val parentBus: Any?
get
init {
<this> as RootBus /*~> Unit */
error("") /* ErrorCallExpression */
}
}
@@ -0,0 +1,64 @@
FILE fqName:<root> fileName:/smartCastInValInitialization.kt
CLASS CLASS name:RootBus modality:FINAL visibility:public superTypes:[<root>.MessageBusImpl]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.RootBus
CONSTRUCTOR visibility:public <> () returnType:<root>.RootBus [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.MessageBusImpl'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:RootBus modality:FINAL visibility:public superTypes:[<root>.MessageBusImpl]'
PROPERTY FAKE_OVERRIDE name:parentBus visibility:public modality:FINAL [fake_override,val]
overridden:
public final parentBus: kotlin.Any? [val]
FUN FAKE_OVERRIDE name:<get-parentBus> visibility:public modality:FINAL <> ($this:<root>.MessageBusImpl) returnType:kotlin.Any? [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:parentBus visibility:public modality:FINAL [fake_override,val]
overridden:
public final fun <get-parentBus> (): kotlin.Any? declared in <root>.MessageBusImpl
$this: VALUE_PARAMETER name:<this> type:<root>.MessageBusImpl
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>.MessageBusImpl
$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>.MessageBusImpl
$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>.MessageBusImpl
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:MessageBusImpl modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MessageBusImpl
CONSTRUCTOR visibility:public <> () returnType:<root>.MessageBusImpl [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MessageBusImpl modality:OPEN visibility:public superTypes:[kotlin.Any]'
PROPERTY name:parentBus visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:parentBus type:kotlin.Any? visibility:private [final]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-parentBus> visibility:public modality:FINAL <> ($this:<root>.MessageBusImpl) returnType:kotlin.Any?
correspondingProperty: PROPERTY name:parentBus visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.MessageBusImpl
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-parentBus> (): kotlin.Any? declared in <root>.MessageBusImpl'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:parentBus type:kotlin.Any? visibility:private [final]' type=kotlin.Any? origin=null
receiver: GET_VAR '<this>: <root>.MessageBusImpl declared in <root>.MessageBusImpl.<get-parentBus>' type=<root>.MessageBusImpl origin=null
ANONYMOUS_INITIALIZER isStatic=false
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
TYPE_OP type=<root>.RootBus origin=CAST typeOperand=<root>.RootBus
GET_VAR '<this>: <root>.MessageBusImpl declared in <root>.MessageBusImpl' type=<root>.MessageBusImpl origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:parentBus type:kotlin.Any? visibility:private [final]' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.MessageBusImpl declared in <root>.MessageBusImpl' type=<root>.MessageBusImpl origin=null
value: CONST Null type=kotlin.Nothing? value=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 [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
@@ -0,0 +1,10 @@
class RootBus: MessageBusImpl()
open class MessageBusImpl {
val parentBus: Any?
init {
this as RootBus
parentBus = null
}
}
@@ -0,0 +1,25 @@
class RootBus : MessageBusImpl {
constructor() /* primary */ {
super/*MessageBusImpl*/()
/* <init>() */
}
}
open class MessageBusImpl {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
val parentBus: Any?
get
init {
<this> as RootBus /*~> Unit */
<this>.#parentBus = null
}
}
@@ -304,6 +304,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
runTest("compiler/testData/ir/irText/classes/secondaryConstructors.kt");
}
@Test
@TestMetadata("smartCastInValInitialization.kt")
public void testSmartCastInValInitialization() throws Exception {
runTest("compiler/testData/ir/irText/classes/smartCastInValInitialization.kt");
}
@Test
@TestMetadata("superCalls.kt")
public void testSuperCalls() throws Exception {
@@ -227,6 +227,11 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase {
runTest("compiler/testData/ir/irText/classes/secondaryConstructors.kt");
}
@TestMetadata("smartCastInValInitialization.kt")
public void testSmartCastInValInitialization() throws Exception {
runTest("compiler/testData/ir/irText/classes/smartCastInValInitialization.kt");
}
@TestMetadata("superCalls.kt")
public void testSuperCalls() throws Exception {
runTest("compiler/testData/ir/irText/classes/superCalls.kt");