blob: 4a97019534fb30ddfb3cc5fdd4a1505a45a05993 [file]
// RUN_PIPELINE_TILL: FRONTEND
// ISSUE: KT-56138
fun takeLambda1(f: String.() -> String) {}
fun takeLambda2(f: String.(String) -> String) {}
fun test_1() {
val x1: String.(String) -> String = { str, str2 -> "this" }
val x2: String.() -> String = { <!UNRESOLVED_REFERENCE!>it<!> }
val x3: String.() -> String = { x -> "x" }
}
fun test_2() {
takeLambda2 <!ARGUMENT_TYPE_MISMATCH!>{ str, <!CANNOT_INFER_VALUE_PARAMETER_TYPE!>str2<!> -> "this" }<!>
takeLambda1 { <!UNRESOLVED_REFERENCE!>it<!> }
takeLambda1 <!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_VALUE_PARAMETER_TYPE!>x<!> -> "x" }<!>
}
fun test_3(b: Boolean) {
val x1: String.(String) -> String = if (b) {
{ str, str2 -> "this" }
} else {
{ str, str2 -> "this" }
}
val x2: String.() -> String = if (b) {
{ <!UNRESOLVED_REFERENCE!>it<!> }
} else {
{ <!UNRESOLVED_REFERENCE!>it<!> }
}
val x3: String.() -> String = if (b) {
{ x -> "x" }
} else {
{ x -> "x" }
}
}
/* GENERATED_FIR_TAGS: functionDeclaration, functionalType, ifExpression, lambdaLiteral, localProperty,
propertyDeclaration, stringLiteral, typeWithExtension */