FIR: introduce ILLEGAL_SUSPEND_FUNCTION_CALL & PROPERTY_ACCESS diagnostics

This commit is contained in:
Mikhail Glukhikh
2021-07-20 16:36:43 +03:00
committed by teamcityserver
parent e4992176c1
commit 8f1d07084b
33 changed files with 147 additions and 222 deletions
@@ -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)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun foo(x: () -> Int) {}