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
@@ -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)
}