LL API: add test for kt -> fir mapping

This commit is contained in:
Ilya Kirillov
2021-07-15 17:14:21 +02:00
committed by teamcityserver
parent b380bcfd99
commit 3ae1fe69da
21 changed files with 146 additions and 0 deletions
@@ -0,0 +1,4 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry
// WITH_STDLIB
<expr>@file:Suppress("")</expr>
@@ -0,0 +1,5 @@
KT element: KtAnnotationEntry
FIR element: FirAnnotationCallImpl
FIR element rendered:
@FILE:R|kotlin/Suppress|(vararg(String()))
@@ -0,0 +1,4 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtSuperTypeCallEntry
open class B(x: Int)
class A : <expr>B(1)</expr>
@@ -0,0 +1,5 @@
KT element: KtSuperTypeCallEntry
FIR element: FirDelegatedConstructorCallImpl
FIR element rendered:
super<R|B|>(Int(1))
@@ -0,0 +1,3 @@
class A(x: Int) {
constructor(y: String) : <expr>this(1)</expr>
}
@@ -0,0 +1,5 @@
KT element: KtConstructorDelegationCall
FIR element: FirDelegatedConstructorCallImpl
FIR element rendered:
this<R|A|>(Int(1))
@@ -0,0 +1,4 @@
// WITH_STDLIB
fun foo(x: List<Int>) {
val a= <expr>x[1]</expr>
}
@@ -0,0 +1,5 @@
KT element: KtArrayAccessExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
R|<local>/x|.R|SubstitutionOverride<kotlin/collections/List.get: R|kotlin/Int|>|(Int(1))
@@ -0,0 +1 @@
val x = 1 <expr>+</expr> 1
@@ -0,0 +1,5 @@
KT element: KtOperationReferenceExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
Int(1).R|kotlin/Int.plus|(Int(1))
@@ -0,0 +1,7 @@
fun foo() {
<expr>
for (x in 0..1) {
}
</expr>
}
@@ -0,0 +1,7 @@
KT element: KtForExpression
FIR element: FirWhileLoopImpl
FIR element rendered:
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval x: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
}
@@ -0,0 +1,6 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtBinaryExpression
fun foo() {
for (x in <expr>0..1</expr>) {
}
}
@@ -0,0 +1,5 @@
KT element: KtBinaryExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
Int(0).R|kotlin/Int.rangeTo|(Int(1))
@@ -0,0 +1,5 @@
fun foo() {
for (<expr>x</expr> in 0..1) {
}
}
@@ -0,0 +1,5 @@
KT element: KtParameter
FIR element: FirPropertyImpl
FIR element rendered:
lval x: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
@@ -0,0 +1,3 @@
fun foo(x: Boolean): Boolean {
return <expr>!</expr>x
}
@@ -0,0 +1,5 @@
KT element: KtOperationReferenceExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
R|<local>/x|.R|kotlin/Boolean.not|()
@@ -0,0 +1,7 @@
fun foo() {
<expr>
while (true) {
}
</expr>
}
@@ -0,0 +1,6 @@
KT element: KtWhileExpression
FIR element: FirWhileLoopImpl
FIR element rendered:
while(Boolean(true)) {
}
@@ -62,6 +62,12 @@ public class GetOrBuildFirTestGenerated extends AbstractGetOrBuildFirTest {
public void testAnnotationApplicationWithArguments() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/annotations/annotationApplicationWithArguments.kt");
}
@Test
@TestMetadata("fileAnnotation.kt")
public void testFileAnnotation() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/annotations/fileAnnotation.kt");
}
}
@Nested
@@ -73,6 +79,18 @@ public class GetOrBuildFirTestGenerated extends AbstractGetOrBuildFirTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/calls"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("constructorDelegationSuperCall.kt")
public void testConstructorDelegationSuperCall() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/calls/constructorDelegationSuperCall.kt");
}
@Test
@TestMetadata("constructorDelegationThisCall.kt")
public void testConstructorDelegationThisCall() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/calls/constructorDelegationThisCall.kt");
}
@Test
@TestMetadata("functionCallArgumentList.kt")
public void testFunctionCallArgumentList() throws Exception {
@@ -117,6 +135,12 @@ public class GetOrBuildFirTestGenerated extends AbstractGetOrBuildFirTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("arrayAccessExpression.kt")
public void testArrayAccessExpression() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions/arrayAccessExpression.kt");
}
@Test
@TestMetadata("asExpression.kt")
public void testAsExpression() throws Exception {
@@ -129,6 +153,12 @@ public class GetOrBuildFirTestGenerated extends AbstractGetOrBuildFirTest {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions/binaryExpression.kt");
}
@Test
@TestMetadata("binaryExpressionOperator.kt")
public void testBinaryExpressionOperator() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions/binaryExpressionOperator.kt");
}
@Test
@TestMetadata("blockExpression.kt")
public void testBlockExpression() throws Exception {
@@ -147,6 +177,13 @@ public class GetOrBuildFirTestGenerated extends AbstractGetOrBuildFirTest {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions/classAccessExpression.kt");
}
@Test
@TestMetadata("forExpressionRange.kt")
public void testForExpressionRange() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions/forExpressionRange.kt");
}
@Test
@TestMetadata("ifExpression.kt")
public void testIfExpression() throws Exception {
@@ -219,12 +256,24 @@ public class GetOrBuildFirTestGenerated extends AbstractGetOrBuildFirTest {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions/unraryExpression.kt");
}
@Test
@TestMetadata("unraryExpressionOperator.kt")
public void testUnraryExpressionOperator() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions/unraryExpressionOperator.kt");
}
@Test
@TestMetadata("whenExpression.kt")
public void testWhenExpression() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions/whenExpression.kt");
}
@Test
@TestMetadata("whileExpression.kt")
public void testWhileExpression() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/getOrBuildFir/expressions/whileExpression.kt");
}
@Test
@TestMetadata("wholeStringTemplate.kt")
public void testWholeStringTemplate() throws Exception {