K2: Fix undesirable NEW_INFERENCE_ERROR for case of return + buildList

While plainly repeating K1 behavior might be a dumb solution,
but inventing another one might be quite complicated
because we need to stop fixing variables into Nothing in many cases,
but probably not in all of them (see KT-58232).

^KT-58149 Fixed
^KT-58232 Related
This commit is contained in:
Denis.Zharkov
2023-04-25 11:42:55 +02:00
committed by Space Team
parent 133992d0bc
commit 0a631ed8fc
8 changed files with 132 additions and 3 deletions
@@ -16935,6 +16935,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/inference/nothingType/reportImplicitNothingOnlyForOwnTypeParameters.kt");
}
@Test
@TestMetadata("returnAsLastStatementInLambda.kt")
public void testReturnAsLastStatementInLambda() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/returnAsLastStatementInLambda.kt");
}
@Test
@TestMetadata("selectWithNull.kt")
public void testSelectWithNull() throws Exception {
@@ -16935,6 +16935,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/inference/nothingType/reportImplicitNothingOnlyForOwnTypeParameters.kt");
}
@Test
@TestMetadata("returnAsLastStatementInLambda.kt")
public void testReturnAsLastStatementInLambda() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/returnAsLastStatementInLambda.kt");
}
@Test
@TestMetadata("selectWithNull.kt")
public void testSelectWithNull() throws Exception {