From adf1df3eb0986e5bf312afaf45f8c3e023e266e2 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 14 Sep 2017 17:42:09 +0200 Subject: [PATCH] Return correct parent for elements under when expression body --- .../src/org/jetbrains/uast/kotlin/KotlinAbstractUElement.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinAbstractUElement.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinAbstractUElement.kt index f6745ddf06b..41831c36a66 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinAbstractUElement.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinAbstractUElement.kt @@ -72,6 +72,11 @@ fun doConvertParent(element: UElement, parent: PsiElement?): UElement? { if (result is UEnumConstant && element is UDeclaration) { return result.initializingClass } + + if (result is USwitchClauseExpressionWithBody && element.psi !is KtWhenCondition) { + return result.body + } + return result }