AA: add tests about platform types

...as declaration return type or expression type
This commit is contained in:
Jinseong Jeon
2022-09-06 23:03:50 -07:00
committed by Ilya Kirillov
parent c8864369fd
commit 68519af97a
13 changed files with 61 additions and 8 deletions
@@ -76,6 +76,12 @@ public class Fe10IdeNormalAnalysisSourceModuleDeclarationReturnTypeTestGenerated
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/overriddenMember.kt");
}
@Test
@TestMetadata("platformType.kt")
public void testPlatformType() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/platformType.kt");
}
@Test
@TestMetadata("propertyAccessor.kt")
public void testPropertyAccessor() throws Exception {
@@ -142,6 +142,12 @@ public class Fe10IdeNormalAnalysisSourceModuleHLExpressionTypeTestGenerated exte
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/nonExpression.kt");
}
@Test
@TestMetadata("platformType.kt")
public void testPlatformType() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/platformType.kt");
}
@Test
@TestMetadata("plusAssign.kt")
public void testPlusAssign() throws Exception {
@@ -76,6 +76,12 @@ public class FirIdeDependentAnalysisSourceModuleDeclarationReturnTypeTestGenerat
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/overriddenMember.kt");
}
@Test
@TestMetadata("platformType.kt")
public void testPlatformType() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/platformType.kt");
}
@Test
@TestMetadata("propertyAccessor.kt")
public void testPropertyAccessor() throws Exception {
@@ -142,6 +142,12 @@ public class FirIdeDependentAnalysisSourceModuleHLExpressionTypeTestGenerated ex
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/nonExpression.kt");
}
@Test
@TestMetadata("platformType.kt")
public void testPlatformType() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/platformType.kt");
}
@Test
@TestMetadata("plusAssign.kt")
public void testPlusAssign() throws Exception {
@@ -76,6 +76,12 @@ public class FirIdeNormalAnalysisSourceModuleDeclarationReturnTypeTestGenerated
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/overriddenMember.kt");
}
@Test
@TestMetadata("platformType.kt")
public void testPlatformType() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/platformType.kt");
}
@Test
@TestMetadata("propertyAccessor.kt")
public void testPropertyAccessor() throws Exception {
@@ -142,6 +142,12 @@ public class FirIdeNormalAnalysisSourceModuleHLExpressionTypeTestGenerated exten
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/nonExpression.kt");
}
@Test
@TestMetadata("platformType.kt")
public void testPlatformType() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/platformType.kt");
}
@Test
@TestMetadata("plusAssign.kt")
public void testPlusAssign() throws Exception {
@@ -16,20 +16,20 @@ abstract class AbstractDeclarationReturnTypeTest : AbstractAnalysisApiSingleFile
override fun doTestByFileStructure(ktFile: KtFile, module: TestModule, testServices: TestServices) {
val actual = buildString {
ktFile.accept(object : KtTreeVisitor<Int>() {
override fun visitDeclaration(dclaration: KtDeclaration, indent: Int): Void? {
if (dclaration is KtTypeParameter) return null
override fun visitDeclaration(declaration: KtDeclaration, indent: Int): Void? {
if (declaration is KtTypeParameter) return null
append(" ".repeat(indent))
if (dclaration is KtClassLikeDeclaration) {
appendLine(dclaration.getNameWithPositionString())
if (declaration is KtClassLikeDeclaration) {
appendLine(declaration.getNameWithPositionString())
} else {
analyseForTest(dclaration) {
val returnType = dclaration.getReturnKtType()
append(dclaration.getNameWithPositionString())
analyseForTest(declaration) {
val returnType = declaration.getReturnKtType()
append(declaration.getNameWithPositionString())
append(" : ")
appendLine(returnType.render())
}
}
return super.visitDeclaration(dclaration, indent + 2)
return super.visitDeclaration(declaration, indent + 2)
}
}, 0)
}
@@ -76,6 +76,12 @@ public class FirStandaloneNormalAnalysisSourceModuleDeclarationReturnTypeTestGen
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/overriddenMember.kt");
}
@Test
@TestMetadata("platformType.kt")
public void testPlatformType() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/declarationReturnType/platformType.kt");
}
@Test
@TestMetadata("propertyAccessor.kt")
public void testPropertyAccessor() throws Exception {
@@ -142,6 +142,12 @@ public class FirStandaloneNormalAnalysisSourceModuleHLExpressionTypeTestGenerate
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/nonExpression.kt");
}
@Test
@TestMetadata("platformType.kt")
public void testPlatformType() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/platformType.kt");
}
@Test
@TestMetadata("plusAssign.kt")
public void testPlusAssign() throws Exception {
@@ -0,0 +1 @@
fun foo() = java.lang.String.valueOf(1)
@@ -0,0 +1 @@
foo@(1,1) : kotlin.String!
@@ -0,0 +1 @@
fun foo() = <expr>java.lang.String.valueOf(1)</expr>
@@ -0,0 +1,2 @@
expression: java.lang.String.valueOf(1)
type: kotlin.String!