Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/coercionToUnit/kt30242.kt
T
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00

65 lines
914 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !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 {
<!INVALID_IF_AS_EXPRESSION!>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 {
<!TYPE_MISMATCH{NI}, TYPE_MISMATCH!>if (b) {
println("meh")
}<!>
}
}
fun test_6(b: Boolean) {
foo {
if (b) {
return@foo Unit
}
if (b) {}
}
}