diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUMethod.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUMethod.kt index 7e5c84dabe0..12b796b8d61 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUMethod.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUMethod.kt @@ -60,7 +60,13 @@ open class KotlinUMethod( .map { KotlinUAnnotation(it, this) } } - private val receiver by lz { (sourcePsi as? KtCallableDeclaration)?.receiverTypeReference } + private val receiver by lz { + when (sourcePsi) { + is KtCallableDeclaration -> sourcePsi + is KtPropertyAccessor -> sourcePsi.property + else -> null + }?.receiverTypeReference + } override val uastParameters by lz { diff --git a/plugins/uast-kotlin/testData/ReceiverFun.log-ide.txt b/plugins/uast-kotlin/testData/ReceiverFun.log-ide.txt index 72e9e538fcd..5d65edb7622 100644 --- a/plugins/uast-kotlin/testData/ReceiverFun.log-ide.txt +++ b/plugins/uast-kotlin/testData/ReceiverFun.log-ide.txt @@ -11,6 +11,9 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = length) UMethod (name = getRx) UParameter (name = $this$getRx) + UAnnotation (fqName = MyReceiverAnnotation) + UNamedExpression (name = name) + ULiteralExpression (value = "RegExp") UAnnotation (fqName = org.jetbrains.annotations.NotNull) UBlockExpression UReturnExpression diff --git a/plugins/uast-kotlin/testData/ReceiverFun.log.txt b/plugins/uast-kotlin/testData/ReceiverFun.log.txt index f977ea5f40f..04d948ad7ff 100644 --- a/plugins/uast-kotlin/testData/ReceiverFun.log.txt +++ b/plugins/uast-kotlin/testData/ReceiverFun.log.txt @@ -11,6 +11,9 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = length) UMethod (name = getRx) UParameter (name = $this$rx) + UAnnotation (fqName = MyReceiverAnnotation) + UNamedExpression (name = name) + ULiteralExpression (value = "RegExp") UAnnotation (fqName = org.jetbrains.annotations.NotNull) UBlockExpression UReturnExpression diff --git a/plugins/uast-kotlin/testData/ReceiverFun.render-ide.txt b/plugins/uast-kotlin/testData/ReceiverFun.render-ide.txt index 9426e0b5506..141eaeb4277 100644 --- a/plugins/uast-kotlin/testData/ReceiverFun.render-ide.txt +++ b/plugins/uast-kotlin/testData/ReceiverFun.render-ide.txt @@ -2,7 +2,7 @@ public final class ReceiverFunKt { public static final fun foo(@MyReceiverAnnotation @org.jetbrains.annotations.NotNull $this$foo: java.lang.String) : int { return this.length } - public static final fun getRx(@org.jetbrains.annotations.NotNull $this$getRx: java.lang.String) : kotlin.text.Regex { + public static final fun getRx(@MyReceiverAnnotation(name = "RegExp") @org.jetbrains.annotations.NotNull $this$getRx: java.lang.String) : kotlin.text.Regex { return toRegex() } } diff --git a/plugins/uast-kotlin/testData/ReceiverFun.render.txt b/plugins/uast-kotlin/testData/ReceiverFun.render.txt index f4a6fd680ec..eb068831c70 100644 --- a/plugins/uast-kotlin/testData/ReceiverFun.render.txt +++ b/plugins/uast-kotlin/testData/ReceiverFun.render.txt @@ -2,7 +2,7 @@ public final class ReceiverFunKt { public static final fun foo(@MyReceiverAnnotation @org.jetbrains.annotations.NotNull $this$foo: java.lang.String) : int { return this.length } - public static final fun getRx(@org.jetbrains.annotations.NotNull $this$rx: java.lang.String) : kotlin.text.Regex { + public static final fun getRx(@MyReceiverAnnotation(name = "RegExp") @org.jetbrains.annotations.NotNull $this$rx: java.lang.String) : kotlin.text.Regex { return toRegex() } }