Generic type arguments inference for lambdas as suspend functions.

This commit is contained in:
Dmitry Petrov
2016-12-14 18:00:52 +03:00
committed by Stanislav Erokhin
parent bf987cff5f
commit 6d73e13798
10 changed files with 55 additions and 26 deletions
@@ -14,4 +14,4 @@ fun test4(): suspend () -> Unit = useSuspendFn {}
fun test5(sfn: suspend () -> Unit) = ambiguous(sfn)
fun test6(fn: () -> Unit) = ambiguous(fn)
fun test7(): () -> Unit = ambiguous {}
fun test7(): () -> Unit = <!OVERLOAD_RESOLUTION_AMBIGUITY!>ambiguous<!> {}
@@ -0,0 +1,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T> withS(x: T, sfn: suspend (T) -> Unit) = x
val test1 = withS(100) {}
fun <TT> test2(x: TT) = withS(x) {}
@@ -0,0 +1,5 @@
package
public val test1: kotlin.Int
public fun </*0*/ TT> test2(/*0*/ x: TT): TT
public fun </*0*/ T> withS(/*0*/ x: T, /*1*/ sfn: suspend (T) -> kotlin.Unit): T
@@ -0,0 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T1, T2> withS2(x: T1, sfn1: suspend (T1) -> T2, sfn2: suspend (T2) -> Unit): T2 = null!!
val test1 = withS2(100, { "" }, { })
@@ -0,0 +1,4 @@
package
public val test1: kotlin.String
public fun </*0*/ T1, /*1*/ T2> withS2(/*0*/ x: T1, /*1*/ sfn1: suspend (T1) -> T2, /*2*/ sfn2: suspend (T2) -> kotlin.Unit): T2