[NI] Make subtyping algorithm more robust to error types
During subtyping/incorporation we transform types (e.g. changing nullability, form of the type) and, basically, we're doing this to some FIXPOINT. It's important that we use `KotlinType.hashCode()` to compare types, but for error types hashCode is a hashCode of its supertype and, for example, `makeNullableAsSpecified` method recreate type every time. So, we continue to generate new constraints and we'll never stop incorporation algorithm
This commit is contained in:
+5
-6
@@ -1,4 +1,3 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// See KT-6665: unresolved reference (v.bar) should not produce "unreachable code" after it
|
||||
|
||||
fun foo(): Int {
|
||||
@@ -29,14 +28,14 @@ fun foo3(): Int {
|
||||
fun bar(): Int {
|
||||
val v = 1
|
||||
val c = v.<!UNRESOLVED_REFERENCE!>bar<!> ?: 42
|
||||
return <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>c<!>
|
||||
return c
|
||||
}
|
||||
|
||||
fun bar2(): Int {
|
||||
val v = 1
|
||||
val c = if (true) v.<!UNRESOLVED_REFERENCE!>bar<!> else 3
|
||||
val b = <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>c<!>
|
||||
return <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>b<!>
|
||||
val b = c
|
||||
return b
|
||||
}
|
||||
|
||||
fun bar3(): Int {
|
||||
@@ -45,6 +44,6 @@ fun bar3(): Int {
|
||||
true -> v.<!UNRESOLVED_REFERENCE!>bar<!>
|
||||
else -> 3
|
||||
}
|
||||
val b = <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>c<!>
|
||||
return <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>b<!>
|
||||
val b = c
|
||||
return b
|
||||
}
|
||||
Reference in New Issue
Block a user