FIR IDE: add additional tests for expression types

This commit is contained in:
Ilya Kirillov
2021-03-05 18:24:57 +01:00
parent 8a28175302
commit d311fe21f8
10 changed files with 107 additions and 0 deletions
@@ -0,0 +1,6 @@
val x = <expr>1 + 2</expr>
// RESULT
// expression: 1 + 2
// type: kotlin.Int
@@ -0,0 +1,10 @@
fun x(): Int {
for(i in 1..2) {
<expr>break</expr>
}
}
// RESULT
// expression: break
// type: kotlin.Nothing
@@ -0,0 +1,7 @@
val a = 12
val x = <expr>12.toByte()</expr>
// RESULT
// expression: 12.toByte()
// type: kotlin.Byte
@@ -0,0 +1,6 @@
val x = <expr>(1 + 2)</expr> + 3
// RESULT
// expression: (1 + 2)
// type: kotlin.Int
@@ -0,0 +1,7 @@
val a = 10
val x = "abc${<expr>a</expr>}defg"
// RESULT
// expression: a
// type: kotlin.Int
@@ -0,0 +1,7 @@
val a = 10
val x = "abc${<expr>a</expr> + 20}defg"
// RESULT
// expression: a
// type: kotlin.Int
@@ -0,0 +1,6 @@
val x = <expr>1</expr>
// RESULT
// expression: 1
// type: kotlin.Int
@@ -0,0 +1,8 @@
fun x(): Int {
<expr>return 1</expr>
}
// RESULT
// expression: return 1
// type: kotlin.Nothing
@@ -0,0 +1,6 @@
val x = <expr>"abc"</expr>
// RESULT
// expression: "abc"
// type: kotlin.String
@@ -34,11 +34,55 @@ public class HLExpressionTypeTestGenerated extends AbstractHLExpressionTypeTest
runTest("idea/idea-frontend-fir/testData/components/expressionType/assignmentExpressionTarget.kt");
}
@TestMetadata("binaryExpression.kt")
public void testBinaryExpression() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/binaryExpression.kt");
}
@TestMetadata("breakExpression.kt")
public void testBreakExpression() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/breakExpression.kt");
}
@TestMetadata("forExpression.kt")
public void testForExpression() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/forExpression.kt");
}
@TestMetadata("functionCall.kt")
public void testFunctionCall() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/functionCall.kt");
}
@TestMetadata("inParens.kt")
public void testInParens() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/inParens.kt");
}
@TestMetadata("insideStringTemplate.kt")
public void testInsideStringTemplate() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplate.kt");
}
@TestMetadata("insideStringTemplateWithBinrary.kt")
public void testInsideStringTemplateWithBinrary() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplateWithBinrary.kt");
}
@TestMetadata("intLiteral.kt")
public void testIntLiteral() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/intLiteral.kt");
}
@TestMetadata("returnExpression.kt")
public void testReturnExpression() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/returnExpression.kt");
}
@TestMetadata("stringLiteral.kt")
public void testStringLiteral() throws Exception {
runTest("idea/idea-frontend-fir/testData/components/expressionType/stringLiteral.kt");
}
@TestMetadata("whileExpression.kt")
public void testWhileExpression() throws Exception {