K2: Fix incorrect inference of delegated property type

It was working incorrectly, because we've been trying to fix
P1 variable to intersectTypes(String?, StubForP2) that should result
to String? because we've got stubEqualsToAnything enabled there,
but nullability was being chosen incorrectly because
`StubForP2.isNullableType()` returned false

NB: The code inside `is ConeTypeVariable` case wasn't working properly
because it always `lookupTag.toSymbol(session)` always returned null,
thus there was effectively five dead lines of code there.

^KT-57814 Fixed
^KT-57921 Related
This commit is contained in:
Denis.Zharkov
2023-04-06 18:54:33 +02:00
committed by Space Team
parent e079d9d405
commit 39639e08f9
8 changed files with 58 additions and 8 deletions
@@ -8829,6 +8829,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/callableReferenceArgumentInDelegatedExpression.kt");
}
@Test
@TestMetadata("decoratedLambda.kt")
public void testDecoratedLambda() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/decoratedLambda.kt");
}
@Test
@TestMetadata("delegateExpressionAsLambda.kt")
public void testDelegateExpressionAsLambda() throws Exception {
@@ -8829,6 +8829,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/callableReferenceArgumentInDelegatedExpression.kt");
}
@Test
@TestMetadata("decoratedLambda.kt")
public void testDecoratedLambda() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/decoratedLambda.kt");
}
@Test
@TestMetadata("delegateExpressionAsLambda.kt")
public void testDelegateExpressionAsLambda() throws Exception {