KT-10322, KT-10646, KT-10647:

- update diagnostic to (supposedly) more useful
- also report IMPLICIT_CAST_TO_ANY if expected type is DONT_CARE
 (effectively "no expected type" for lambda expression).
This commit is contained in:
Dmitry Petrov
2016-01-13 19:31:23 +03:00
parent f54de08073
commit 609ffc10a9
15 changed files with 118 additions and 40 deletions
@@ -46,7 +46,7 @@ fun f3() = <!INVALID_IF_AS_EXPRESSION!>if (true) 42<!>
fun f4(): Unit = <!INVALID_IF_AS_EXPRESSION!>if (true) work()<!>
fun f5(): Unit = <!INVALID_IF_AS_EXPRESSION!>if (true) mlist.add()<!>
fun f6(): Unit = <!INVALID_IF_AS_EXPRESSION!>if (true) 42<!>
fun g1() = <!IMPLICIT_CAST_TO_UNIT_OR_ANY!><!NO_ELSE_IN_WHEN!>when<!> { true -> work() }<!>
fun g1() = <!NO_ELSE_IN_WHEN!>when<!> { true -> work() }
fun g2() = <!NO_ELSE_IN_WHEN!>when<!> { true -> mlist.add() }
fun g3() = <!NO_ELSE_IN_WHEN!>when<!> { true -> 42 }
fun g4(): Unit = <!NO_ELSE_IN_WHEN!>when<!> { true -> work() }