Extension functions & inference.

This commit is contained in:
Dmitry Petrov
2016-12-15 10:32:23 +03:00
committed by Stanislav Erokhin
parent 845e116aa9
commit eec96f1954
7 changed files with 40 additions and 3 deletions
@@ -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, { toLong().toString() }, { length })
@@ -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