[FE 1.0] Support suspend only SAM conversions
^KT-50477 Fixed
This commit is contained in:
committed by
teamcity
parent
d2c0234895
commit
22b2554368
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: -SuspendOnlySamConversions
|
||||
|
||||
fun interface FI {
|
||||
suspend fun call() // suspending now(!!!)
|
||||
}
|
||||
|
||||
fun accept(fi: FI): Int = TODO()
|
||||
|
||||
suspend fun foo() {}
|
||||
fun foo2() {}
|
||||
|
||||
fun main() {
|
||||
val fi: suspend () -> Unit = {} // Lambda of a suspending(!!!) functional type
|
||||
accept(fi) // ERROR: Type mismatch. Required: FI Found: suspend () → Unit
|
||||
|
||||
accept(::foo)
|
||||
val x1 = ::foo
|
||||
accept(x1) // ERROR: Type mismatch. Required: FI Found: suspend () → Unit
|
||||
|
||||
accept(::foo2)
|
||||
val x2 = ::foo2
|
||||
accept(x2)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: -SuspendOnlySamConversions
|
||||
|
||||
fun interface FI {
|
||||
suspend fun call() // suspending now(!!!)
|
||||
}
|
||||
|
||||
fun accept(fi: FI): Int = TODO()
|
||||
|
||||
suspend fun foo() {}
|
||||
fun foo2() {}
|
||||
|
||||
fun main() {
|
||||
val fi: suspend () -> Unit = {} // Lambda of a suspending(!!!) functional type
|
||||
accept(<!TYPE_MISMATCH!>fi<!>) // ERROR: Type mismatch. Required: FI Found: suspend () → Unit
|
||||
|
||||
accept(::foo)
|
||||
val x1 = ::foo
|
||||
accept(<!TYPE_MISMATCH!>x1<!>) // ERROR: Type mismatch. Required: FI Found: suspend () → Unit
|
||||
|
||||
accept(::foo2)
|
||||
val x2 = ::foo2
|
||||
accept(x2)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public fun accept(/*0*/ fi: FI): kotlin.Int
|
||||
public suspend fun foo(): kotlin.Unit
|
||||
public fun foo2(): kotlin.Unit
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public fun interface FI {
|
||||
public abstract suspend fun call(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user