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:
+11
-2
@@ -1,7 +1,16 @@
|
||||
val test1 = { <!IMPLICIT_CAST_TO_UNIT_OR_ANY!>when (true) { true -> 1; else -> "" }<!> }
|
||||
val test1 = { when (true) { true -> <!IMPLICIT_CAST_TO_ANY!>1<!>; else -> <!IMPLICIT_CAST_TO_ANY!>""<!> } }
|
||||
|
||||
val test2 = { { <!IMPLICIT_CAST_TO_UNIT_OR_ANY!>when (true) { true -> 1; else -> "" }<!> } }
|
||||
val test2 = { { when (true) { true -> <!IMPLICIT_CAST_TO_ANY!>1<!>; else -> <!IMPLICIT_CAST_TO_ANY!>""<!> } } }
|
||||
|
||||
val test3: (Boolean) -> Any = { when (true) { true -> 1; else -> "" } }
|
||||
|
||||
val test4: (Boolean) -> Any? = { when (true) { true -> 1; else -> "" } }
|
||||
|
||||
fun println() {}
|
||||
|
||||
val test5 = {
|
||||
when (true) {
|
||||
true -> println()
|
||||
else -> println()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user