Uast: Fix getExpressionType for elvis expression

#KT-18997 Fixed Target Versions 1.1.5
This commit is contained in:
Vyacheslav Gerasimov
2017-08-21 23:55:43 +03:00
parent e06cb1ec39
commit 2e1edaf3d4
3 changed files with 31 additions and 6 deletions
@@ -7,7 +7,6 @@ import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
import org.jetbrains.uast.*
import org.jetbrains.uast.test.env.findElementByText
import org.jetbrains.uast.visitor.UastVisitor
import org.junit.Assert
import org.junit.Test
@@ -98,4 +97,11 @@ class KotlinUastApiTest : AbstractKotlinUastTest() {
test2.fields.find { it.name == "bar" }!!.annotations.single { it.qualifiedName == "MyAnnotation" }
}
}
@Test fun testElvisType() {
doTest("ElvisType") { _, file ->
val elvisExpression = file.findElementByText<UExpression>("text ?: return")
assertEquals("String", elvisExpression.getExpressionType()!!.presentableText)
}
}
}