FIR: add raw fir building delegate expression test

This commit is contained in:
Ilya Kirillov
2020-10-08 21:21:03 +03:00
parent 971e551bae
commit 7611135a4a
10 changed files with 95 additions and 0 deletions
@@ -60,6 +60,11 @@ public class LightTree2FirConverterTestCaseGenerated extends AbstractLightTree2F
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt");
}
@TestMetadata("delegates.kt")
public void testDelegates() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt");
}
@TestMetadata("derivedClass.kt")
public void testDerivedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt");
@@ -0,0 +1,13 @@
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
val x: Int by lazy { 1 + 2 }
val delegate = object: ReadWriteProperty<Any?, Int> {
override fun getValue(thisRef: Any?, property: KProperty<*>): Int = 1
override fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {}
}
val value by delegate
var variable by delegate
@@ -0,0 +1,18 @@
FILE: delegates.kt
public? final? val x: Intby LAZY_EXPRESSION
public? get(): <implicit> {
^ D|/x|.getValue#(Null(null), ::R|/x|)
}
public? final? val delegate: <implicit> = LAZY_EXPRESSION
public? get(): <implicit>
public? final? val value: <implicit>by LAZY_EXPRESSION
public? get(): <implicit> {
^ D|/value|.getValue#(Null(null), ::R|/value|)
}
public? final? var variable: <implicit>by LAZY_EXPRESSION
public? get(): <implicit> {
^ D|/variable|.getValue#(Null(null), ::R|/variable|)
}
public? set(<set-?>: <implicit>): R|kotlin/Unit| {
D|/variable|.setValue#(Null(null), ::R|/variable|, R|<local>/variable|)
}
@@ -0,0 +1,34 @@
FILE: delegates.kt
public? final? val x: Intby lazy#(<L> = lazy@fun <implicit>.<anonymous>(): <implicit> {
IntegerLiteral(1).plus#(IntegerLiteral(2))
}
)
public? get(): <implicit> {
^ D|/x|.getValue#(Null(null), ::R|/x|)
}
public? final? val delegate: <implicit> = object : ReadWriteProperty<Any?, Int> {
private constructor(): R|<anonymous>| {
super<<implicit>>()
}
public? open? override fun getValue(thisRef: Any?, property: KProperty<*>): Int {
^getValue IntegerLiteral(1)
}
public? open? override fun setValue(thisRef: Any?, property: KProperty<*>, value: Int): R|kotlin/Unit| {
}
}
public? get(): <implicit>
public? final? val value: <implicit>by delegate#
public? get(): <implicit> {
^ D|/value|.getValue#(Null(null), ::R|/value|)
}
public? final? var variable: <implicit>by delegate#
public? get(): <implicit> {
^ D|/variable|.getValue#(Null(null), ::R|/variable|)
}
public? set(<set-?>: <implicit>): R|kotlin/Unit| {
D|/variable|.setValue#(Null(null), ::R|/variable|, R|<local>/variable|)
}
@@ -60,6 +60,11 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt");
}
@TestMetadata("delegates.kt")
public void testDelegates() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt");
}
@TestMetadata("derivedClass.kt")
public void testDerivedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt");
@@ -60,6 +60,11 @@ public class RawFirBuilderTestCaseGenerated extends AbstractRawFirBuilderTestCas
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt");
}
@TestMetadata("delegates.kt")
public void testDelegates() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt");
}
@TestMetadata("derivedClass.kt")
public void testDerivedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt");
@@ -60,6 +60,11 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt");
}
@TestMetadata("delegates.kt")
public void testDelegates() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt");
}
@TestMetadata("derivedClass.kt")
public void testDerivedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt");
@@ -60,6 +60,11 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt");
}
@TestMetadata("delegates.kt")
public void testDelegates() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt");
}
@TestMetadata("derivedClass.kt")
public void testDerivedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt");
@@ -38,6 +38,11 @@ public class FirHighlightingPerformanceTestGenerated extends AbstractFirHighligh
runTest("idea/testData/highlighter/AutoCreatedItParameter.kt");
}
@TestMetadata("DelegatingCtor.kt")
public void testDelegatingCtor() throws Exception {
runTest("idea/testData/highlighter/DelegatingCtor.kt");
}
@TestMetadata("Destructuring.kt")
public void testDestructuring() throws Exception {
runTest("idea/testData/highlighter/Destructuring.kt");