Uast: don't throw exception if can't get a receiver parameter for annotation (KT-40494)
This commit is contained in:
+5
-2
@@ -1,3 +1,6 @@
|
||||
annotation class MyReceiverAnnotation
|
||||
annotation class MyReceiverAnnotation(val name: String = "")
|
||||
|
||||
fun @receiver:MyReceiverAnnotation String.foo() = this.length
|
||||
fun @receiver:MyReceiverAnnotation String.foo() = this.length
|
||||
|
||||
val @receiver:MyReceiverAnnotation("RegExp") String.rx : Regex
|
||||
get() { return toRegex() }
|
||||
@@ -0,0 +1,22 @@
|
||||
UFile (package = )
|
||||
UClass (name = ReceiverFunKt)
|
||||
UMethod (name = foo)
|
||||
UParameter (name = $this$foo)
|
||||
UAnnotation (fqName = MyReceiverAnnotation)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UQualifiedReferenceExpression
|
||||
UThisExpression (label = null)
|
||||
USimpleNameReferenceExpression (identifier = length)
|
||||
UMethod (name = getRx)
|
||||
UParameter (name = $this$getRx)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toRegex))
|
||||
USimpleNameReferenceExpression (identifier = toRegex, resolvesTo = null)
|
||||
UClass (name = MyReceiverAnnotation)
|
||||
UAnnotationMethod (name = name)
|
||||
ULiteralExpression (value = "")
|
||||
@@ -9,4 +9,14 @@ UFile (package = )
|
||||
UQualifiedReferenceExpression
|
||||
UThisExpression (label = null)
|
||||
USimpleNameReferenceExpression (identifier = length)
|
||||
UMethod (name = getRx)
|
||||
UParameter (name = $this$rx)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toRegex))
|
||||
USimpleNameReferenceExpression (identifier = toRegex, resolvesTo = null)
|
||||
UClass (name = MyReceiverAnnotation)
|
||||
UAnnotationMethod (name = name)
|
||||
ULiteralExpression (value = "")
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
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 {
|
||||
return toRegex()
|
||||
}
|
||||
}
|
||||
|
||||
public abstract annotation MyReceiverAnnotation {
|
||||
public abstract fun name() : java.lang.String = UastEmptyExpression
|
||||
}
|
||||
@@ -2,7 +2,11 @@ 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 {
|
||||
return toRegex()
|
||||
}
|
||||
}
|
||||
|
||||
public abstract annotation MyReceiverAnnotation {
|
||||
public abstract fun name() : java.lang.String = UastEmptyExpression
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user