[NI] Prioritize variables with trivial constraints over complex ones
Consider the following constraint system (from the test example): Nothing? <: V1 F!! <: V2 Inv<V1> <: S Inv<V2> <: S Where V1, V2, S are type variables, and F has nullable upper bound. Type variable fixation order should be: V2 -> V1 -> S, and the problem was that previously after fixation of type variable V2 we were trying to fix S (before V1), so we had the following constraints on S: Inv<F!!> <: S Inv<V1> <: S => S were fixed to Inv<F!!> And after this V1 was fixed to F!! which is contradictory as Nothing? is not a subtype of F!!. #KT-33033 Fixed
This commit is contained in:
@@ -10341,6 +10341,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fixTypeVariableWithNothingConstraintEarlierThanComplexVariable.kt")
|
||||
public void testFixTypeVariableWithNothingConstraintEarlierThanComplexVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/fixTypeVariableWithNothingConstraintEarlierThanComplexVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ignoreConstraintFromImplicitInNothing.kt")
|
||||
public void testIgnoreConstraintFromImplicitInNothing() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt");
|
||||
|
||||
Generated
+5
@@ -10336,6 +10336,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fixTypeVariableWithNothingConstraintEarlierThanComplexVariable.kt")
|
||||
public void testFixTypeVariableWithNothingConstraintEarlierThanComplexVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/fixTypeVariableWithNothingConstraintEarlierThanComplexVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ignoreConstraintFromImplicitInNothing.kt")
|
||||
public void testIgnoreConstraintFromImplicitInNothing() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt");
|
||||
|
||||
Reference in New Issue
Block a user