NI: Prefer nullable lower bound to flexible one when substitution of type variable is performed and remember flexibility of type parameters based on flexibility of its upper bounds

^KT-32435 Fixed
This commit is contained in:
Victor Petukhov
2019-12-16 11:46:10 +03:00
parent 68576da494
commit 437a26684d
41 changed files with 985 additions and 85 deletions
@@ -8099,6 +8099,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt");
}
@TestMetadata("lambdaInLambda2.kt")
public void testLambdaInLambda2() throws Exception {
runTest("compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.kt");
}
@TestMetadata("prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt")
public void testPrematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument() throws Exception {
runTest("compiler/testData/diagnostics/tests/functionLiterals/prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt");
@@ -14900,6 +14905,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/nullableTypes/elvisOnUnit.kt");
}
@TestMetadata("inferenceFlexibleTToNullable.kt")
public void testInferenceFlexibleTToNullable() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/inferenceFlexibleTToNullable.kt");
}
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/nullAssertOnTypeWithNullableUpperBound.kt");
@@ -14945,6 +14955,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/nullableTypes/safeCallWithInvoke.kt");
}
@TestMetadata("takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt")
public void testTakingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt");
}
@TestMetadata("uselessElvis.kt")
public void testUselessElvis() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt");
@@ -18930,6 +18945,16 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
}
@TestMetadata("samConversionToGeneric.kt")
public void testSamConversionToGeneric() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.kt");
}
@TestMetadata("samConversionsWithSmartCasts.kt")
public void testSamConversionsWithSmartCasts() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.kt");
}
@TestMetadata("sameCandidatesFromKotlinAndJavaInOneScope.kt")
public void testSameCandidatesFromKotlinAndJavaInOneScope() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/sameCandidatesFromKotlinAndJavaInOneScope.kt");
@@ -8094,6 +8094,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt");
}
@TestMetadata("lambdaInLambda2.kt")
public void testLambdaInLambda2() throws Exception {
runTest("compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.kt");
}
@TestMetadata("prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt")
public void testPrematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument() throws Exception {
runTest("compiler/testData/diagnostics/tests/functionLiterals/prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt");
@@ -14895,6 +14900,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/nullableTypes/elvisOnUnit.kt");
}
@TestMetadata("inferenceFlexibleTToNullable.kt")
public void testInferenceFlexibleTToNullable() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/inferenceFlexibleTToNullable.kt");
}
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/nullAssertOnTypeWithNullableUpperBound.kt");
@@ -14940,6 +14950,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/nullableTypes/safeCallWithInvoke.kt");
}
@TestMetadata("takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt")
public void testTakingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt");
}
@TestMetadata("uselessElvis.kt")
public void testUselessElvis() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt");
@@ -18920,6 +18935,16 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
}
@TestMetadata("samConversionToGeneric.kt")
public void testSamConversionToGeneric() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.kt");
}
@TestMetadata("samConversionsWithSmartCasts.kt")
public void testSamConversionsWithSmartCasts() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.kt");
}
@TestMetadata("sameCandidatesFromKotlinAndJavaInOneScope.kt")
public void testSameCandidatesFromKotlinAndJavaInOneScope() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/sameCandidatesFromKotlinAndJavaInOneScope.kt");
@@ -18541,6 +18541,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("inferenceFlexibleTToNullable.kt")
public void testInferenceFlexibleTToNullable() throws Exception {
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
}
@TestMetadata("unsafeNullCheck.kt")
public void testUnsafeNullCheck() throws Exception {
runTest("compiler/testData/codegen/box/platformTypes/unsafeNullCheck.kt");
@@ -18541,6 +18541,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("inferenceFlexibleTToNullable.kt")
public void testInferenceFlexibleTToNullable() throws Exception {
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
}
@TestMetadata("unsafeNullCheck.kt")
public void testUnsafeNullCheck() throws Exception {
runTest("compiler/testData/codegen/box/platformTypes/unsafeNullCheck.kt");
@@ -17025,6 +17025,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("inferenceFlexibleTToNullable.kt")
public void testInferenceFlexibleTToNullable() throws Exception {
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
}
@TestMetadata("unsafeNullCheck.kt")
public void testUnsafeNullCheck() throws Exception {
runTest("compiler/testData/codegen/box/platformTypes/unsafeNullCheck.kt");
@@ -17025,6 +17025,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("inferenceFlexibleTToNullable.kt")
public void testInferenceFlexibleTToNullable() throws Exception {
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
}
@TestMetadata("unsafeNullCheck.kt")
public void testUnsafeNullCheck() throws Exception {
runTest("compiler/testData/codegen/box/platformTypes/unsafeNullCheck.kt");