Type parameter as result type: more precise expected type definition #KT-5385 Fixed

Tests for KT-5385 KT-10223 KT-7800 KT-7817 + something related
This commit is contained in:
Mikhail Glukhikh
2015-11-27 18:59:02 +03:00
parent 51abb021bc
commit 5729855e4f
24 changed files with 352 additions and 13 deletions
@@ -11,6 +11,6 @@ fun test(bal: Array<Int>) {
val <!UNUSED_VARIABLE!>e<!>: Unit = run { bar += 4 }
val <!UNUSED_VARIABLE!>f<!>: Int = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>run { bar += 4 }<!>
val <!UNUSED_VARIABLE!>f<!>: Int = run { <!ASSIGNMENT_TYPE_MISMATCH!>bar += 4<!> }
}
fun <T> run(f: () -> T): T = f()
@@ -7,10 +7,10 @@ val a : (Int?) -> Int = l@ {
fun <R> let(<!UNUSED_PARAMETER!>f<!>: (Int?) -> R): R = null!!
val b: Int = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>let {
if (it != null) return@let it
val b: Int = let {
if (it != null) return@let <!DEBUG_INFO_SMARTCAST!>it<!>
5
}<!>
}
val c: Int = let {
if (it != null) <!DEBUG_INFO_SMARTCAST!>it<!> else 5