irText tests for KT-19306

This commit is contained in:
Dmitry Petrov
2020-12-23 14:04:24 +03:00
committed by TeamCityServer
parent 9f908cdf7c
commit 0841a6b0ea
8 changed files with 187 additions and 8 deletions
@@ -197,6 +197,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt");
}
@TestMetadata("kt19306.kt")
public void testKt19306() throws Exception {
runTest("compiler/testData/ir/irText/classes/kt19306.kt");
}
@TestMetadata("kt31649.kt")
public void testKt31649() throws Exception {
runTest("compiler/testData/ir/irText/classes/kt31649.kt");
+17
View File
@@ -0,0 +1,17 @@
// SKIP_KT_DUMP
// FILE: kt19306_test1.kt
package test1
abstract class A {
protected var p = ""
private set
}
// FILE: kt19306_test2.kt
package test2
import test1.A
class B : A() {
fun test() = { -> p }
}
@@ -0,0 +1,39 @@
FILE fqName:test1 fileName:/kt19306_test1.kt
CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test1.A
CONSTRUCTOR visibility:public <> () returnType:test1.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
PROPERTY name:p visibility:protected modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private
EXPRESSION_BODY
CONST String type=kotlin.String value=""
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-p> visibility:protected modality:FINAL <> ($this:test1.A) returnType:kotlin.String
correspondingProperty: PROPERTY name:p visibility:protected modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:test1.A
BLOCK_BODY
RETURN type=kotlin.Nothing from='protected final fun <get-p> (): kotlin.String declared in test1.A'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR '<this>: test1.A declared in test1.A.<get-p>' type=test1.A origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-p> visibility:private modality:FINAL <> ($this:test1.A, <set-?>:kotlin.String) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:p visibility:protected modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:test1.A
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.String
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: test1.A declared in test1.A.<set-p>' type=test1.A origin=null
value: GET_VAR '<set-?>: kotlin.String declared in test1.A.<set-p>' type=kotlin.String 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 [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
+39
View File
@@ -0,0 +1,39 @@
FILE fqName:test1 fileName:/kt19306_test1.kt
CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test1.A
CONSTRUCTOR visibility:public <> () returnType:test1.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
PROPERTY name:p visibility:protected modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private
EXPRESSION_BODY
CONST String type=kotlin.String value=""
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-p> visibility:protected modality:FINAL <> ($this:test1.A) returnType:kotlin.String
correspondingProperty: PROPERTY name:p visibility:protected modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:test1.A
BLOCK_BODY
RETURN type=kotlin.Nothing from='protected final fun <get-p> (): kotlin.String declared in test1.A'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR '<this>: test1.A declared in test1.A.<get-p>' type=test1.A origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-p> visibility:private modality:FINAL <> ($this:test1.A, <set-?>:kotlin.String) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:p visibility:protected modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:test1.A
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.String
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: test1.A declared in test1.A.<set-p>' type=test1.A origin=null
value: GET_VAR '<set-?>: kotlin.String declared in test1.A.<set-p>' type=kotlin.String 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 [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,36 @@
FILE fqName:test2 fileName:/kt19306_test2.kt
CLASS CLASS name:B modality:FINAL visibility:public superTypes:[test1.A]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test2.B
CONSTRUCTOR visibility:public <> () returnType:test2.B [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in test1.A'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[test1.A]'
FUN name:test visibility:public modality:FINAL <> ($this:test2.B) returnType:kotlin.Function0<kotlin.String>
$this: VALUE_PARAMETER name:<this> type:test2.B
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.Function0<kotlin.String> declared in test2.B'
FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in test2.B.test'
CALL 'protected final fun <get-p> (): kotlin.String declared in test1.A' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR '<this>: test2.B declared in test2.B.test' type=test2.B origin=null
PROPERTY FAKE_OVERRIDE name:p visibility:protected modality:FINAL [fake_override,var]
FUN FAKE_OVERRIDE name:<get-p> visibility:protected modality:FINAL <> ($this:test1.A) returnType:kotlin.String [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:p visibility:protected modality:FINAL [fake_override,var]
overridden:
protected final fun <get-p> (): kotlin.String declared in test1.A
$this: VALUE_PARAMETER name:<this> type:test1.A
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
+36
View File
@@ -0,0 +1,36 @@
FILE fqName:test2 fileName:/kt19306_test2.kt
CLASS CLASS name:B modality:FINAL visibility:public superTypes:[test1.A]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test2.B
CONSTRUCTOR visibility:public <> () returnType:test2.B [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in test1.A'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[test1.A]'
FUN name:test visibility:public modality:FINAL <> ($this:test2.B) returnType:kotlin.Function0<kotlin.String>
$this: VALUE_PARAMETER name:<this> type:test2.B
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.Function0<kotlin.String> declared in test2.B'
FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in test2.B.test'
CALL 'protected final fun <get-p> (): kotlin.String [fake_override] declared in test2.B' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR '<this>: test2.B declared in test2.B.test' type=test2.B origin=null
PROPERTY FAKE_OVERRIDE name:p visibility:protected modality:FINAL [fake_override,var]
FUN FAKE_OVERRIDE name:<get-p> visibility:protected modality:FINAL <> ($this:test1.A) returnType:kotlin.String [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:p visibility:protected modality:FINAL [fake_override,var]
overridden:
protected final fun <get-p> (): kotlin.String declared in test1.A
$this: VALUE_PARAMETER name:<this> type:test1.A
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 test1.A
$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 test1.A
$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 test1.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -119,15 +119,17 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() {
TestCase.assertEquals("IR dump mismatch after deep copy with symbols", actualTrees, copiedTrees)
verify(irFileCopy)
val kotlinLikeDump = irFile.dumpKotlinLike(
KotlinLikeDumpOptions(
printFileName = false,
printFilePath = false,
printFakeOverridesStrategy = FakeOverridesStrategy.NONE
if (!testFile.directives.contains("SKIP_KT_DUMP")) {
val kotlinLikeDump = irFile.dumpKotlinLike(
KotlinLikeDumpOptions(
printFileName = false,
printFilePath = false,
printFakeOverridesStrategy = FakeOverridesStrategy.NONE
)
)
)
val kotlinLikeDumpExpectedFile = irTreeFileLabel.expectedTextFile.withReplacedExtensionOrNull(".txt", ".kt.txt")!!
KotlinTestUtils.assertEqualsToFile(kotlinLikeDumpExpectedFile, kotlinLikeDump)
val kotlinLikeDumpExpectedFile = irTreeFileLabel.expectedTextFile.withReplacedExtensionOrNull(".txt", ".kt.txt")!!
KotlinTestUtils.assertEqualsToFile(kotlinLikeDumpExpectedFile, kotlinLikeDump)
}
}
try {
@@ -196,6 +196,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
runTest("compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt");
}
@TestMetadata("kt19306.kt")
public void testKt19306() throws Exception {
runTest("compiler/testData/ir/irText/classes/kt19306.kt");
}
@TestMetadata("kt31649.kt")
public void testKt31649() throws Exception {
runTest("compiler/testData/ir/irText/classes/kt31649.kt");