Report error about invalid if as expression on the if keyword

#KT-14633 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-06-21 18:51:05 +03:00
parent e40c8fff05
commit 9847278699
16 changed files with 111 additions and 112 deletions
@@ -8,23 +8,23 @@ fun testMixedIfAndWhen() =
if (true)
when {
true -> if (true) <!IMPLICIT_CAST_TO_ANY!>42<!>
else <!IMPLICIT_CAST_TO_ANY!>1<!>
true -> if (true) <!IMPLICIT_CAST_TO_ANY!>42<!>
else <!IMPLICIT_CAST_TO_ANY!>println()<!>
else -> <!INVALID_IF_AS_EXPRESSION!>if (true) <!IMPLICIT_CAST_TO_ANY!>println()<!><!>
else <!IMPLICIT_CAST_TO_ANY!>1<!>
true -> if (true) <!IMPLICIT_CAST_TO_ANY!>42<!>
else <!IMPLICIT_CAST_TO_ANY!>println()<!>
else -> <!INVALID_IF_AS_EXPRESSION!>if<!> (true) <!IMPLICIT_CAST_TO_ANY!>println()<!>
}
else <!IMPLICIT_CAST_TO_ANY!>println()<!>
fun testWrappedExpressions() =
if (true) {
println()
<!INVALID_IF_AS_EXPRESSION!>if (true) {
<!INVALID_IF_AS_EXPRESSION!>if<!> (true) {
println()
if (true) {
<!IMPLICIT_CAST_TO_ANY!>println()<!>
}
else <!IMPLICIT_CAST_TO_ANY!>{}<!>
}<!>
}
}
else {
(((<!IMPLICIT_CAST_TO_ANY!>((42)) + 1<!>)))