[Spec tests] Add test for Coercion to Unit error diagnostics absence

This commit is contained in:
anastasiia.spaseeva
2020-07-28 11:11:31 +03:00
parent 26ac87d9be
commit 73850e97d7
5 changed files with 98 additions and 0 deletions
@@ -0,0 +1,11 @@
// TESTCASE NUMBER: 1
val y0 = when (2) {
else -> if (true) {""}
}
val w:Any = TODO()
val y1 = when (2) {
else -> if (true) {""} // false ok with coercion to Unit
}
@@ -0,0 +1,20 @@
/*
* KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: coercion-to-unit
* NUMBER: 1
* DESCRIPTION: Coercion to Unit error diagnostics absence
* ISSUES: KT-38490
*/
// TESTCASE NUMBER: 1
val y0 = when (<!UNUSED_EXPRESSION!>2<!>) {
else -> <!INVALID_IF_AS_EXPRESSION!>if<!> (true) {""}
}
val w:Any = TODO()
val y1 = when (2) {
else -> if (true) {""} // false ok with coercion to Unit
}
@@ -0,0 +1,5 @@
package
public val w: kotlin.Any
public val y0: kotlin.Unit
public val y1: kotlin.Unit