FIR: introduce ILLEGAL_SUSPEND_FUNCTION_CALL & PROPERTY_ACCESS diagnostics
This commit is contained in:
committed by
teamcityserver
parent
e4992176c1
commit
8f1d07084b
Vendored
-19
@@ -1,19 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun foo(x: () -> Int) {}
|
||||
fun foo(x: suspend () -> Int) {}
|
||||
|
||||
fun usualCall(): Int = 42
|
||||
suspend fun suspendCall(): Int = 42
|
||||
|
||||
// it's important to have ambiguity in these cases to introduce overload resolution by suspend modifier in future
|
||||
fun test1() {
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!> { usualCall() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!> { suspendCall() }
|
||||
}
|
||||
|
||||
// candidate without suspend conversions is more specific
|
||||
fun test2(f: () -> Int, g: suspend () -> Int) {
|
||||
foo(f)
|
||||
foo(g)
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun foo(x: () -> Int) {}
|
||||
|
||||
Reference in New Issue
Block a user