Add test for extension properties declaration in IR

This commit is contained in:
Dmitry Petrov
2018-01-16 14:58:15 +03:00
parent 1f841e35bc
commit bba8168150
3 changed files with 68 additions and 0 deletions
@@ -0,0 +1,13 @@
val String.test1 get() = 42
var String.test2
get() = 42
set(value) {}
class Host {
val String.test3 get() = 42
var String.test4
get() = 42
set(value) {}
}
@@ -0,0 +1,49 @@
FILE fqName:<root> fileName:/extensionProperties.kt
PROPERTY name:test1 type:kotlin.Int visibility:public modality:FINAL flags:val
FUN name:<get-test1> visibility:public modality:FINAL <> ($receiver:kotlin.String) returnType:Int flags:
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String flags:
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test1>() on String: Int'
CONST Int type=kotlin.Int value=42
PROPERTY name:test2 type:kotlin.Int visibility:public modality:FINAL flags:var
FUN name:<get-test2> visibility:public modality:FINAL <> ($receiver:kotlin.String) returnType:Int flags:
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String flags:
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test2>() on String: Int'
CONST Int type=kotlin.Int value=42
FUN name:<set-test2> visibility:public modality:FINAL <> ($receiver:kotlin.String, value:kotlin.Int) returnType:Unit flags:
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String flags:
VALUE_PARAMETER name:value index:0 type:kotlin.Int flags:
BLOCK_BODY
CLASS CLASS name:Host modality:FINAL visibility:public flags:
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:Host flags:
CONSTRUCTOR visibility:public <> () returnType:Host flags:
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
INSTANCE_INITIALIZER_CALL classDescriptor='Host'
PROPERTY name:test3 type:kotlin.Int visibility:public modality:FINAL flags:val
FUN name:<get-test3> visibility:public modality:FINAL <> ($this:Host, $receiver:kotlin.String) returnType:Int flags:
$this: VALUE_PARAMETER name:<this> type:Host flags:
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String flags:
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test3>() on String: Int'
CONST Int type=kotlin.Int value=42
PROPERTY name:test4 type:kotlin.Int visibility:public modality:FINAL flags:var
FUN name:<get-test4> visibility:public modality:FINAL <> ($this:Host, $receiver:kotlin.String) returnType:Int flags:
$this: VALUE_PARAMETER name:<this> type:Host flags:
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String flags:
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test4>() on String: Int'
CONST Int type=kotlin.Int value=42
FUN name:<set-test4> visibility:public modality:FINAL <> ($this:Host, $receiver:kotlin.String, value:kotlin.Int) returnType:Unit flags:
$this: VALUE_PARAMETER name:<this> type:Host flags:
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String flags:
VALUE_PARAMETER name:value index:0 type:kotlin.Int flags:
BLOCK_BODY
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:Boolean flags:
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:Int flags:
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:String flags:
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
@@ -252,6 +252,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
doTest(fileName);
}
@TestMetadata("extensionProperties.kt")
public void testExtensionProperties() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/extensionProperties.kt");
doTest(fileName);
}
@TestMetadata("fakeOverrides.kt")
public void testFakeOverrides() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/fakeOverrides.kt");