Uast: tests for no implicit returns in lambdas (KT-32370)
This commit is contained in:
@@ -37,6 +37,14 @@ fun foo() {
|
|||||||
it + b
|
it + b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val x: () -> Unit = {
|
||||||
|
val (a, b) = listOf(1, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
val y: () -> Unit = {
|
||||||
|
listOf(1)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private inline fun bar(lmbd: (Int) -> Int) {
|
private inline fun bar(lmbd: (Int) -> Int) {
|
||||||
|
|||||||
@@ -96,6 +96,40 @@ UFile (package = org.jetbrains.uast.kotlin)
|
|||||||
UBinaryExpression (operator = +)
|
UBinaryExpression (operator = +)
|
||||||
USimpleNameReferenceExpression (identifier = it)
|
USimpleNameReferenceExpression (identifier = it)
|
||||||
USimpleNameReferenceExpression (identifier = b)
|
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)
|
UAnnotationMethod (name = bar)
|
||||||
UParameter (name = lmbd)
|
UParameter (name = lmbd)
|
||||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||||
|
|||||||
@@ -29,6 +29,14 @@ public final class LambdaReturnKt {
|
|||||||
var b: int = 1
|
var b: int = 1
|
||||||
return it + b
|
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 {
|
private static final fun bar(@org.jetbrains.annotations.NotNull lmbd: kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Integer>) : void {
|
||||||
invoke(1)
|
invoke(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user