[NI] Don't forget to analyze whole block for last postponed expression

This commit is contained in:
Mikhail Zarechenskiy
2017-12-18 04:43:04 +03:00
parent 8ed8e05a68
commit d818af5287
10 changed files with 108 additions and 40 deletions
@@ -0,0 +1,15 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_EXPRESSION
import java.util.HashSet
fun test123() {
val g: (Int) -> Unit = if (true) {
val set = HashSet<Int>()
fun (i: Int) {
set.add(i)
}
}
else {
{ it -> it }
}
}
@@ -0,0 +1,3 @@
package
public fun test123(): kotlin.Unit
@@ -1,11 +1,10 @@
// !WITH_NEW_INFERENCE
// !CHECK_TYPE
fun test() {
val a = if (true) {
val x = 1
({ <!NI;UNRESOLVED_REFERENCE!>x<!> })
({ x })
} else {
{ <!NI;UNUSED_EXPRESSION!>2<!> }
{ 2 }
}
<!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!> <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>checkType<!> { <!NI;UNRESOLVED_REFERENCE!>_<!><() -> Int>() }
a checkType { _<() -> Int>() }
}
@@ -1,13 +1,12 @@
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_EXPRESSION
import java.util.HashSet
fun test123() {
val g: (Int) -> Unit = if (true) {
val set = <!NI;DEBUG_INFO_MISSING_UNRESOLVED!>HashSet<!><<!NI;DEBUG_INFO_MISSING_UNRESOLVED!>Int<!>>();
val set = HashSet<Int>();
{ i ->
<!NI;UNRESOLVED_REFERENCE!>set<!>.<!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>add<!>(i)
set.add(i)
}
}
else {