[NI] Add missing diagnostic on callable references in fake calls
Unresolved reference diagnositc was not reported on callable references returned from if or when expression because of additional block wrapper. ^KT-30953 Fixed
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
fun testWhen(x: Any?) {
|
||||
val y = when (x) {
|
||||
null -> ""
|
||||
else -> ::<!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun testWhenWithBraces(x: Any?) {
|
||||
val z = when(x) {
|
||||
null -> { "" }
|
||||
else -> { ::<!UNRESOLVED_REFERENCE!>unresolved<!> }
|
||||
}
|
||||
}
|
||||
|
||||
fun testIf(x: Any?) {
|
||||
val y = if (x != null) ::<!UNRESOLVED_REFERENCE!>unresolved<!> else null
|
||||
}
|
||||
|
||||
fun testIfWithBraces(x: Any?) {
|
||||
val z = if (x != null) { ::<!UNRESOLVED_REFERENCE!>unresolved<!> } else { null }
|
||||
}
|
||||
|
||||
fun testElvis(x: Any?) {
|
||||
val y = x ?: ::<!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
}
|
||||
|
||||
fun testExclExcl() {
|
||||
val y = :: <!UNRESOLVED_REFERENCE!>unresolved<!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||
}
|
||||
|
||||
fun testTry() {
|
||||
val v = try { ::<!UNRESOLVED_REFERENCE!>unresolved<!> } catch (e: Exception) {}
|
||||
}
|
||||
Reference in New Issue
Block a user