[FIR-TEST] Add new testdata generated after changes in previous commit

This commit is contained in:
Dmitriy Novozhilov
2019-12-11 16:16:22 +03:00
parent e9c02a1cca
commit 2536fa0cd5
4578 changed files with 104067 additions and 1 deletions
@@ -0,0 +1,51 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// !WITH_NEW_INFERENCE
// !CHECK_TYPE
fun case_0() {
val z: Any? = 10
val y = z.run {
this as Int
this // error in NI: required Int, found Any?; just inferred to Any? in OI
}
y checkType { <!UNRESOLVED_REFERENCE!>_<!><Any?>() }
y checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
}
fun case_1(z: Any?) {
val y = z.run {
when (this) {
is String -> return@run this // type mismatch in the new inference (required String, found Any?)
is Float -> ""
else -> return@run ""
}
}
y checkType { <!UNRESOLVED_REFERENCE!>_<!><Any?>() }
y checkType { <!UNRESOLVED_REFERENCE!>_<!><kotlin.String>() }
// y is inferred to Any?
}
fun case_2(z: Any?) {
val y = z.run {
when (this) {
is String -> this
is Float -> ""
else -> return@run ""
}
}
y checkType { <!UNRESOLVED_REFERENCE!>_<!><kotlin.String>() }
// y is inferred to String
}
fun case_3(z: Any?) {
val y = z.let {
when (it) {
is String -> return@let it
is Float -> ""
else -> return@let ""
}
}
y checkType { <!UNRESOLVED_REFERENCE!>_<!><Any?>() }
y checkType { <!UNRESOLVED_REFERENCE!>_<!><kotlin.String>() }
// y is inferred to String
}