UAST: Fix for unsafe cast for class initializer (EA-109918)
This commit is contained in:
committed by
Dmitry Jemerov
parent
1a8be635b9
commit
1fa5152cb7
@@ -74,6 +74,23 @@ class KotlinDetachedUastTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
|
||||
}
|
||||
|
||||
fun testLiteralInClassInitializerFromFactory() {
|
||||
|
||||
val detachedClass = KtPsiFactory(project).createClass("""
|
||||
class MyAnnotation(){
|
||||
init {
|
||||
"default"
|
||||
}
|
||||
}
|
||||
""")
|
||||
|
||||
val literalInside = detachedClass.findUElementByTextFromPsi<UElement>("default")
|
||||
generateSequence(literalInside, { it.uastParent }).count().let {
|
||||
TestCase.assertTrue("it should have some parents $it actually", it > 1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <T> T?.orFail(msg: String): T = this ?: error(msg)
|
||||
Reference in New Issue
Block a user