[NI] Update filtering of constraints with equal types
Make check for synthetic nullability constraint status before skipping new constraint with nonunique type.
This commit is contained in:
+5
-1
@@ -49,7 +49,11 @@ class MutableVariableWithConstraints(
|
|||||||
|
|
||||||
// return new actual constraint, if this constraint is new
|
// return new actual constraint, if this constraint is new
|
||||||
fun addConstraint(constraint: Constraint): Constraint? {
|
fun addConstraint(constraint: Constraint): Constraint? {
|
||||||
val previousConstraintWithSameType = constraints.filter { it.typeHashCode == constraint.typeHashCode && it.type == constraint.type }
|
val previousConstraintWithSameType = constraints.filter { oldConstraint ->
|
||||||
|
oldConstraint.typeHashCode == constraint.typeHashCode
|
||||||
|
&& oldConstraint.type == constraint.type
|
||||||
|
&& oldConstraint.isNullabilityConstraint == constraint.isNullabilityConstraint
|
||||||
|
}
|
||||||
|
|
||||||
if (previousConstraintWithSameType.any { previous -> newConstraintIsUseless(previous, constraint) })
|
if (previousConstraintWithSameType.any { previous -> newConstraintIsUseless(previous, constraint) })
|
||||||
return null
|
return null
|
||||||
|
|||||||
+11
-4
@@ -1,9 +1,16 @@
|
|||||||
// !LANGUAGE: +NewInference
|
|
||||||
// !WITH_NEW_INFERENCE
|
// !WITH_NEW_INFERENCE
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
fun <M> make(): M? = null
|
fun <M> make(): M? = null
|
||||||
fun <I> id(arg: I): I = arg
|
fun <I> id(arg: I): I = arg
|
||||||
|
fun <S> select(vararg args: S): S = TODO()
|
||||||
|
|
||||||
val v = id(
|
fun test() {
|
||||||
make()
|
id(
|
||||||
)
|
make()
|
||||||
|
)
|
||||||
|
|
||||||
|
select(make(), null)
|
||||||
|
|
||||||
|
if (true) make() else TODO()
|
||||||
|
}
|
||||||
|
|||||||
+11
-4
@@ -1,9 +1,16 @@
|
|||||||
// !LANGUAGE: +NewInference
|
|
||||||
// !WITH_NEW_INFERENCE
|
// !WITH_NEW_INFERENCE
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
fun <M> make(): M? = null
|
fun <M> make(): M? = null
|
||||||
fun <I> id(arg: I): I = arg
|
fun <I> id(arg: I): I = arg
|
||||||
|
fun <S> select(vararg args: S): S = TODO()
|
||||||
|
|
||||||
val v = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id<!>(
|
fun test() {
|
||||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>make<!>()
|
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id<!>(
|
||||||
)
|
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>make<!>()
|
||||||
|
)
|
||||||
|
|
||||||
|
select(make(), null)
|
||||||
|
|
||||||
|
<!OI;TYPE_INFERENCE_FAILED_ON_SPECIAL_CONSTRUCT!>if<!> (true) <!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>make()<!> else TODO()
|
||||||
|
}
|
||||||
|
|||||||
+2
-3
@@ -1,7 +1,6 @@
|
|||||||
package
|
package
|
||||||
|
|
||||||
public val v: [ERROR : Type for id(
|
|
||||||
make()
|
|
||||||
)]
|
|
||||||
public fun </*0*/ I> id(/*0*/ arg: I): I
|
public fun </*0*/ I> id(/*0*/ arg: I): I
|
||||||
public fun </*0*/ M> make(): M?
|
public fun </*0*/ M> make(): M?
|
||||||
|
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
|||||||
Reference in New Issue
Block a user