IR text: add a test with data object
This commit is contained in:
committed by
Space Team
parent
98fb4f1f45
commit
a86279b766
+6
@@ -2618,6 +2618,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
|
||||
runTest("compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dataObject.kt")
|
||||
public void testDataObject() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/dataObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("DeepCopyIrTree.kt")
|
||||
public void testDeepCopyIrTree() throws Exception {
|
||||
|
||||
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
Generated
+6
@@ -2618,6 +2618,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dataObject.kt")
|
||||
public void testDataObject() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/dataObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("DeepCopyIrTree.kt")
|
||||
public void testDeepCopyIrTree() throws Exception {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
FILE fqName:<root> fileName:/dataObject.kt
|
||||
CLASS OBJECT name:DataObject modality:FINAL visibility:public [data] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.DataObject
|
||||
CONSTRUCTOR visibility:private <> () returnType:<root>.DataObject [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:DataObject modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
|
||||
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.DataObject, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:<this> type:<root>.DataObject
|
||||
VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any?
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: 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>.DataObject declared in <root>.DataObject.equals' type=<root>.DataObject origin=null
|
||||
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.DataObject.equals' type=kotlin.Any? origin=null
|
||||
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.DataObject'
|
||||
CONST Boolean type=kotlin.Boolean value=true
|
||||
WHEN type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=<root>.DataObject
|
||||
GET_VAR 'other: kotlin.Any? declared in <root>.DataObject.equals' type=kotlin.Any? origin=null
|
||||
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.DataObject'
|
||||
CONST Boolean type=kotlin.Boolean value=false
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.DataObject [val]
|
||||
TYPE_OP type=<root>.DataObject origin=CAST typeOperand=<root>.DataObject
|
||||
GET_VAR 'other: kotlin.Any? declared in <root>.DataObject.equals' type=kotlin.Any? origin=null
|
||||
RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.DataObject'
|
||||
CONST Boolean type=kotlin.Boolean value=true
|
||||
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.DataObject) returnType:kotlin.Int
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:<this> type:<root>.DataObject
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.DataObject'
|
||||
CONST Int type=kotlin.Int value=-1155894359
|
||||
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.DataObject) returnType:kotlin.String
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:<this> type:<root>.DataObject
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.DataObject'
|
||||
CONST String type=kotlin.String value="DataObject"
|
||||
@@ -0,0 +1,28 @@
|
||||
data object DataObject {
|
||||
private constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
when {
|
||||
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
|
||||
}
|
||||
when {
|
||||
other !is DataObject -> return false
|
||||
}
|
||||
val tmp0_other_with_cast: DataObject = other as DataObject
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return -1155894359
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "DataObject"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
FILE fqName:<root> fileName:/dataObject.kt
|
||||
CLASS OBJECT name:DataObject modality:FINAL visibility:public [data] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.DataObject
|
||||
CONSTRUCTOR visibility:private <> () returnType:<root>.DataObject [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:DataObject modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
|
||||
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.DataObject) returnType:kotlin.String
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.DataObject
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.DataObject'
|
||||
CONST String type=kotlin.String value="DataObject"
|
||||
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.DataObject) returnType:kotlin.Int
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.DataObject
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.DataObject'
|
||||
CONST Int type=kotlin.Int value=-1155894359
|
||||
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.DataObject, other:kotlin.Any?) returnType:kotlin.Boolean [operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.DataObject
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: 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>.DataObject declared in <root>.DataObject.equals' type=<root>.DataObject origin=null
|
||||
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.DataObject.equals' type=kotlin.Any? origin=null
|
||||
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.DataObject'
|
||||
CONST Boolean type=kotlin.Boolean value=true
|
||||
WHEN type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=<root>.DataObject
|
||||
GET_VAR 'other: kotlin.Any? declared in <root>.DataObject.equals' type=kotlin.Any? origin=null
|
||||
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.DataObject'
|
||||
CONST Boolean type=kotlin.Boolean value=false
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.DataObject [val]
|
||||
TYPE_OP type=<root>.DataObject origin=CAST typeOperand=<root>.DataObject
|
||||
GET_VAR 'other: kotlin.Any? declared in <root>.DataObject.equals' type=kotlin.Any? origin=null
|
||||
RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.DataObject'
|
||||
CONST Boolean type=kotlin.Boolean value=true
|
||||
@@ -0,0 +1,3 @@
|
||||
// LANGUAGE: +DataObjects
|
||||
|
||||
data object DataObject
|
||||
@@ -0,0 +1,27 @@
|
||||
data object DataObject {
|
||||
private constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "DataObject"
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return -1155894359
|
||||
}
|
||||
|
||||
override operator fun equals(other: Any?): Boolean {
|
||||
when {
|
||||
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
|
||||
}
|
||||
when {
|
||||
other !is DataObject -> return false
|
||||
}
|
||||
val tmp0_other_with_cast: DataObject = other as DataObject
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -2618,6 +2618,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
|
||||
runTest("compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dataObject.kt")
|
||||
public void testDataObject() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/dataObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("DeepCopyIrTree.kt")
|
||||
public void testDeepCopyIrTree() throws Exception {
|
||||
|
||||
+5
@@ -1900,6 +1900,11 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase {
|
||||
runTest("compiler/testData/ir/irText/firProblems/cannotCastToFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dataObject.kt")
|
||||
public void testDataObject() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/dataObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DeepCopyIrTree.kt")
|
||||
public void testDeepCopyIrTree() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/DeepCopyIrTree.kt");
|
||||
|
||||
Generated
+6
@@ -2174,6 +2174,12 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT
|
||||
runTest("compiler/testData/ir/irText/firProblems/cannotCastToFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dataObject.kt")
|
||||
public void testDataObject() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/dataObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("DeepCopyIrTree.kt")
|
||||
public void testDeepCopyIrTree() throws Exception {
|
||||
|
||||
+6
@@ -2174,6 +2174,12 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/cannotCastToFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dataObject.kt")
|
||||
public void testDataObject() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/dataObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("DeepCopyIrTree.kt")
|
||||
public void testDeepCopyIrTree() throws Exception {
|
||||
|
||||
+6
@@ -2174,6 +2174,12 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/cannotCastToFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dataObject.kt")
|
||||
public void testDataObject() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/dataObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("DeepCopyIrTree.kt")
|
||||
public void testDeepCopyIrTree() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user