Files
kotlin-fork/compiler/testData/diagnostics/tests/resolve/callableReferenceInCST.kt
T
Pavel Kirpichenkov 95a8060946 [NI] Don't report uninferred type parameter error on special functions
Type parameters can't be specified explicitly for special constructions.
Reporting this error does not help fixing the cause of it and needlessly
reveals implementation details.

^KT-36342 Fixed
2020-02-12 17:33:42 +03:00

37 lines
877 B
Kotlin
Vendored

// !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<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
}
fun testTry() {
val v = try { ::<!UNRESOLVED_REFERENCE!>unresolved<!> } catch (e: Exception) {}
}