NI: Prefer nullable lower bound to flexible one when substitution of type variable is performed

^KT-32435 Fixed
This commit is contained in:
Victor Petukhov
2019-12-07 20:24:53 +03:00
committed by victor.petukhov
parent 78dfcef160
commit 09c2b92b1d
14 changed files with 187 additions and 4 deletions
@@ -20,7 +20,7 @@ interface PsiMethod {
interface PsiClass
fun test() {
val processor = AdapterProcessor<PsiMethod, PsiClass>(
val processor = AdapterProcessor<PsiMethod, PsiClass?>(
Function { method: PsiMethod? -> method?.containingClass }
)
}
@@ -7,7 +7,7 @@ FILE: main.kt
public abstract interface PsiClass : R|kotlin/Any| {
}
public final fun test(): R|kotlin/Unit| {
lval processor: R|AdapterProcessor<PsiMethod, PsiClass>| = R|/AdapterProcessor.AdapterProcessor|<R|PsiMethod|, R|PsiClass|>(R|/Function|<R|PsiMethod|, R|ft<PsiClass, PsiClass?>!|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
lval processor: R|AdapterProcessor<PsiMethod, PsiClass?>| = R|/AdapterProcessor.AdapterProcessor|<R|PsiMethod|, R|PsiClass?|>(R|/Function|<R|PsiMethod|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
R|<local>/method|?.R|/PsiMethod.containingClass|
}
))
@@ -14635,6 +14635,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
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");