Extension functions & inference.
This commit is contained in:
committed by
Stanislav Erokhin
parent
845e116aa9
commit
eec96f1954
+7
@@ -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) {}
|
||||
+5
@@ -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
|
||||
+5
@@ -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 })
|
||||
+4
@@ -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
|
||||
Reference in New Issue
Block a user