Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/coercionToUnit/kt30242.fir.kt
T
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00

64 lines
850 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
// ISSUE: KT-30242
class A
fun println(s: String = "") {}
fun foo(f: () -> Any) {}
fun test1(b: Boolean) {
foo {
if (b) {
println("meh")
}
}
}
fun test2(b: Boolean) {
foo {
when {
b -> println("meh")
}
}
}
fun test3(b: Boolean) {
foo {
if (b) {
return@foo A()
}
}
}
fun test4(b: Boolean) {
foo {
if (b) {
return@foo println("meh")
}
if (b) {
println()
}
}
}
fun bar(block: () -> String) {}
fun test_5(b: Boolean) {
bar {
<!ARGUMENT_TYPE_MISMATCH!>if (b) {
println("meh")
}<!>
}
}
fun test_6(b: Boolean) {
foo {
if (b) {
return@foo Unit
}
if (b) {}
}
}