NI: don't try to infer visible lambda parameters, if there is single one – extension parameter
^KT-37038 Fixed
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_ANONYMOUS_PARAMETER
|
||||
|
||||
fun main() {
|
||||
val x1: String.() -> String = if (true) {{ this }} else {{ this }}
|
||||
val x2: String.() -> String = if (true) {{ -> this }} else {{ -> this }}
|
||||
val x3: () -> String = if (true) {{ -> "this" }} else {{ -> "this" }}
|
||||
val x4: String.() -> String = if (true) {{ str: String -> "this" }} else {{ str: String -> "this" }}
|
||||
val x5: String.() -> String = if (true) {{ str -> "this" }} else {{ str -> "this" }}
|
||||
val x6: String.() -> String = if (true) {{ str -> "this" }} else {{ "this" }}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_ANONYMOUS_PARAMETER
|
||||
|
||||
fun <T> select(vararg x: T) = x[0]
|
||||
|
||||
fun main() {
|
||||
val x1: String.() -> String = if (true) {{ this }} else {{ this }}
|
||||
val x2: String.() -> String = if (true) {{ -> this }} else {{ -> this }}
|
||||
val x3: () -> String = if (true) {{ -> "this" }} else {{ -> "this" }}
|
||||
val x4: String.() -> String = if (true) {{ str: String -> "this" }} else {{ str: String -> "this" }}
|
||||
val x5: String.() -> String = if (true) <!TYPE_MISMATCH!>{{ <!CANNOT_INFER_PARAMETER_TYPE, EXPECTED_PARAMETERS_NUMBER_MISMATCH!>str<!> -> "this" }}<!> else <!TYPE_MISMATCH!>{{ <!CANNOT_INFER_PARAMETER_TYPE, EXPECTED_PARAMETERS_NUMBER_MISMATCH!>str<!> -> "this" }}<!>
|
||||
val x6: String.() -> String = if (true) <!TYPE_MISMATCH!>{{ <!CANNOT_INFER_PARAMETER_TYPE, EXPECTED_PARAMETERS_NUMBER_MISMATCH!>str<!> -> "this" }}<!> else {{ "this" }}
|
||||
val x7: String.() -> String = select({ -> this }, { -> this })
|
||||
val x8: String.() -> String = select({ this }, { this })
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
Reference in New Issue
Block a user