report type mismatch deeply on branches for if

in type argument inference case
This commit is contained in:
Svetlana Isakova
2013-07-31 18:16:01 +04:00
parent c5b6ee4df3
commit e2f681c587
5 changed files with 107 additions and 27 deletions
@@ -0,0 +1,27 @@
package b
fun bar(i: Int) = i
fun test(a: Int?, b: Int?) {
bar(if (a == null) return else <!TYPE_MISMATCH!>b<!>)
}
fun test(a: Int?, b: Int?, c: Int?) {
bar(if (a == null) return else if (b == null) return else <!TYPE_MISMATCH!>c<!>)
}
fun test(a: Any?, b: Any?, c: Int?) {
bar(if (a == null) if (b == null) <!TYPE_MISMATCH!>c<!> else return else return)
}
fun test(a: Int?, b: Any?, c: Int?) {
bar(if (a == null) {
return
} else {
if (b == null) {
return
} else {
<!TYPE_MISMATCH!>c<!>
}
})
}