Uast: handling reified methods receivers (KT-37613)

This commit is contained in:
Nicolay Mitropolsky
2020-03-27 12:51:43 +03:00
parent d6d19b563d
commit 0ca67c1bac
13 changed files with 110 additions and 34 deletions
+2
View File
@@ -12,6 +12,8 @@ UFile (package = test.pkg)
UClassLiteralExpression
USimpleNameReferenceExpression (identifier = java)
UMethod (name = systemService1)
UParameter (name = $this$systemService1)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UBlockExpression
UReturnExpression
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
+1 -1
View File
@@ -4,7 +4,7 @@ public final class ReifiedKt {
public static final fun systemService2(@org.jetbrains.annotations.NotNull $this$systemService2: test.pkg.Context) : error.NonExistentClass {
return <anonymous class>(java.lang.String.java)
}
fun systemService1() : <ErrorType> {
fun systemService1(@org.jetbrains.annotations.NotNull $this$systemService1: test.pkg.Context) : <ErrorType> {
return <anonymous class>(T.java)
}
}
+4
View File
@@ -2,6 +2,10 @@ inline fun <reified T> functionWithLambda(t: T, process: (T) -> Int): Int = proc
inline fun <reified T> functionWithVararg(i: Int?, vararg t: T): T = t[0]
inline fun <reified T> T.functionWithReceiver(i: Int?): T = this
inline fun <reified T> T.`name with spaces`(i: Int?): T = this
inline fun <reified T> functionWithParamAnnotation(@Suppress("s") t: T): T = t
inline fun <reified T> functionUnresolved(@Suppress("s") t: Unresolved<T>): T = t
+16
View File
@@ -21,6 +21,22 @@ UFile (package = )
UArrayAccessExpression
USimpleNameReferenceExpression (identifier = t)
ULiteralExpression (value = 0)
UMethod (name = functionWithReceiver)
UParameter (name = $this$functionWithReceiver)
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
UParameter (name = i)
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
UBlockExpression
UReturnExpression
UThisExpression (label = null)
UMethod (name = name with spaces)
UParameter (name = $this$name with spaces)
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
UParameter (name = i)
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
UBlockExpression
UReturnExpression
UThisExpression (label = null)
UMethod (name = functionWithParamAnnotation)
UParameter (name = t)
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
@@ -5,6 +5,12 @@ public final class ReifiedParametersKt {
fun functionWithVararg(@org.jetbrains.annotations.Nullable i: int, @org.jetbrains.annotations.Nullable t: T) : T {
return t[0]
}
fun functionWithReceiver(@org.jetbrains.annotations.Nullable $this$functionWithReceiver: T, @org.jetbrains.annotations.Nullable i: int) : T {
return this
}
fun name with spaces(@org.jetbrains.annotations.Nullable $this$name with spaces: T, @org.jetbrains.annotations.Nullable i: int) : T {
return this
}
fun functionWithParamAnnotation(@org.jetbrains.annotations.Nullable @kotlin.Suppress(names = "s") t: T) : T {
return t
}
@@ -47,10 +47,14 @@ UFile (package = )
UReturnExpression
ULiteralExpression (value = 42)
UMethod (name = function6)
UParameter (name = $this$function6)
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
UParameter (name = t)
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
UParameter (name = i)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UParameter (name = s)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UBlockExpression
UReturnExpression
USimpleNameReferenceExpression (identifier = t)
@@ -95,10 +99,14 @@ UFile (package = )
UReturnExpression
USimpleNameReferenceExpression (identifier = t)
UMethod (name = function11)
UParameter (name = $this$function11)
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
UParameter (name = t)
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
UParameter (name = i)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UParameter (name = s)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UBlockExpression
UReturnExpression
USimpleNameReferenceExpression (identifier = t)
+2 -2
View File
@@ -12,7 +12,7 @@ public final class ReifiedReturnTypeKt {
fun function5(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : int {
return 42
}
fun function6(@org.jetbrains.annotations.Nullable t: T, i: int, s: java.lang.String) : T {
fun function6(@org.jetbrains.annotations.Nullable $this$function6: T, @org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T {
return t
}
fun function7(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T {
@@ -27,7 +27,7 @@ public final class ReifiedReturnTypeKt {
fun function10(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T {
return t
}
fun function11(@org.jetbrains.annotations.Nullable t: T, i: int, s: java.lang.String) : T {
fun function11(@org.jetbrains.annotations.Nullable $this$function11: T, @org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T {
return t
}
}