Uast: tests for no implicit returns in lambdas (KT-32370)

This commit is contained in:
Nicolay Mitropolsky
2019-07-04 10:51:51 +03:00
parent a180d78eaf
commit 5d081efe60
3 changed files with 50 additions and 0 deletions
+8
View File
@@ -37,6 +37,14 @@ fun foo() {
it + b
}
val x: () -> Unit = {
val (a, b) = listOf(1, 2)
}
val y: () -> Unit = {
listOf(1)
}
}
private inline fun bar(lmbd: (Int) -> Int) {
+34
View File
@@ -96,6 +96,40 @@ UFile (package = org.jetbrains.uast.kotlin)
UBinaryExpression (operator = +)
USimpleNameReferenceExpression (identifier = it)
USimpleNameReferenceExpression (identifier = b)
UDeclarationsExpression
ULocalVariable (name = x)
ULambdaExpression
UBlockExpression
UDeclarationsExpression
ULocalVariable (name = vardbcd0724)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
UIdentifier (Identifier (listOf))
USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null)
ULiteralExpression (value = 1)
ULiteralExpression (value = 2)
ULocalVariable (name = a)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UQualifiedReferenceExpression
USimpleNameReferenceExpression (identifier = vardbcd0724)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (component1))
USimpleNameReferenceExpression (identifier = <anonymous class>, resolvesTo = null)
ULocalVariable (name = b)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UQualifiedReferenceExpression
USimpleNameReferenceExpression (identifier = vardbcd0724)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (component2))
USimpleNameReferenceExpression (identifier = <anonymous class>, resolvesTo = null)
UDeclarationsExpression
ULocalVariable (name = y)
ULambdaExpression
UBlockExpression
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
UIdentifier (Identifier (listOf))
USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null)
ULiteralExpression (value = 1)
UAnnotationMethod (name = bar)
UParameter (name = lmbd)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
+8
View File
@@ -29,6 +29,14 @@ public final class LambdaReturnKt {
var b: int = 1
return it + b
})
var x: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = {
@org.jetbrains.annotations.NotNull var vardbcd0724: <ErrorType> = listOf(1, 2)
@org.jetbrains.annotations.NotNull var a: int = vardbcd0724.<anonymous class>()
@org.jetbrains.annotations.NotNull var b: int = vardbcd0724.<anonymous class>()
}
var y: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = {
listOf(1)
}
}
private static final fun bar(@org.jetbrains.annotations.NotNull lmbd: kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Integer>) : void {
invoke(1)