[NI] Consider synthetic lower nullability constraint non-proper

This commit is contained in:
Pavel Kirpichenkov
2020-01-15 14:14:54 +03:00
parent 07041574da
commit 2896642f94
7 changed files with 43 additions and 1 deletions
@@ -10808,6 +10808,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nestedLambdaInferenceWithIncorporationOfVariables.kt");
}
@TestMetadata("notEnoughInformationFromNullabilityConstraint.kt")
public void testNotEnoughInformationFromNullabilityConstraint() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/notEnoughInformationFromNullabilityConstraint.kt");
}
@TestMetadata("nothingWithCallableReference.kt")
public void testNothingWithCallableReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nothingWithCallableReference.kt");
@@ -131,7 +131,9 @@ class VariableFixationFinder(
notFixedTypeVariables[variable]?.constraints?.any { isProperArgumentConstraint(it) } ?: false
private fun Context.isProperArgumentConstraint(c: Constraint) =
isProperType(c.type) && c.position.initialConstraint.position !is DeclaredUpperBoundConstraintPosition
isProperType(c.type)
&& c.position.initialConstraint.position !is DeclaredUpperBoundConstraintPosition
&& !c.isNullabilityConstraint
private fun Context.isProperType(type: KotlinTypeMarker): Boolean =
!type.contains { notFixedTypeVariables.containsKey(it.typeConstructor()) }
@@ -0,0 +1,9 @@
// !LANGUAGE: +NewInference
// !WITH_NEW_INFERENCE
fun <M> make(): M? = null
fun <I> id(arg: I): I = arg
val v = id(
make()
)
@@ -0,0 +1,9 @@
// !LANGUAGE: +NewInference
// !WITH_NEW_INFERENCE
fun <M> make(): M? = null
fun <I> id(arg: I): I = arg
val v = <!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<!>()
)
@@ -0,0 +1,7 @@
package
public val v: [ERROR : Type for id(
make()
)]
public fun </*0*/ I> id(/*0*/ arg: I): I
public fun </*0*/ M> make(): M?
@@ -10815,6 +10815,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nestedLambdaInferenceWithIncorporationOfVariables.kt");
}
@TestMetadata("notEnoughInformationFromNullabilityConstraint.kt")
public void testNotEnoughInformationFromNullabilityConstraint() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/notEnoughInformationFromNullabilityConstraint.kt");
}
@TestMetadata("nothingWithCallableReference.kt")
public void testNothingWithCallableReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nothingWithCallableReference.kt");
@@ -10810,6 +10810,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nestedLambdaInferenceWithIncorporationOfVariables.kt");
}
@TestMetadata("notEnoughInformationFromNullabilityConstraint.kt")
public void testNotEnoughInformationFromNullabilityConstraint() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/notEnoughInformationFromNullabilityConstraint.kt");
}
@TestMetadata("nothingWithCallableReference.kt")
public void testNothingWithCallableReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nothingWithCallableReference.kt");