[NI] Avoid constraints from expected type for effectively empty system
Expression will be checked against expected type later. Theoretically, this is not very good, but it aligns with the old inference, plus it helps avoiding multiple type mismatch diagnostics.
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
fun calc(x: List<String>?, y: Int?): Int {
|
||||
x?.get(y!! - 1)
|
||||
// y!! above should not provide smart cast here
|
||||
val yy: Int = <!NI;TYPE_MISMATCH, TYPE_MISMATCH!>y<!>
|
||||
val yy: Int = <!TYPE_MISMATCH!>y<!>
|
||||
return yy + (x?.size ?: 0)
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,5 +3,5 @@
|
||||
fun calc(x: List<String>?, y: Int?): Int {
|
||||
x?.subList(y!! - 1, <!DEBUG_INFO_SMARTCAST!>y<!>)
|
||||
// y!! above should not provide smart cast here
|
||||
return <!NI;TYPE_MISMATCH, TYPE_MISMATCH!>y<!>
|
||||
return <!TYPE_MISMATCH!>y<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ fun calc(x: String?, y: Int?): Int {
|
||||
// Smart cast because of x!! in receiver
|
||||
foo(x!!)?.subSequence(y!!, <!DEBUG_INFO_SMARTCAST!>x<!>.length)?.length
|
||||
// No smart cast possible
|
||||
return <!NI;TYPE_MISMATCH, TYPE_MISMATCH!>y<!>
|
||||
return <!TYPE_MISMATCH!>y<!>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user