[FIR] Implement FirReturnAllowedChecker
Supported diagnostics: - RETURN_NOT_ALLOWED - RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY
This commit is contained in:
committed by
TeamCityServer
parent
254ff77977
commit
3cb17ac2f0
+5
@@ -259,6 +259,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/labelAndReceiverForInfix.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("labeledReturnFromNotLabeledUnnamedFunction.kt")
|
||||
public void testLabeledReturnFromNotLabeledUnnamedFunction() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/labeledReturnFromNotLabeledUnnamedFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaArgInScopeFunction.kt")
|
||||
public void testLambdaArgInScopeFunction() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun <T> simpleRun(f: (T) -> Unit): Unit = f(return)
|
||||
fun <T> simpleRun(f: (T) -> Unit): Unit = f(<!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!>)
|
||||
|
||||
fun <T, R> List<T>.simpleMap(f: (T) -> R): R {
|
||||
|
||||
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
FILE: labeledReturnFromNotLabeledUnnamedFunction.kt
|
||||
public final fun notInline(block: R|(kotlin/Boolean) -> kotlin/Unit|): R|kotlin/String| {
|
||||
^notInline String()
|
||||
}
|
||||
public final fun test(): R|kotlin/String| {
|
||||
^test R|/notInline|(fun <anonymous>(b: R|kotlin/Boolean|): R|kotlin/Unit| <inline=NoInline> {
|
||||
^@notInline Unit
|
||||
}
|
||||
)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun notInline(block: (Boolean) -> Unit): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
fun test(): String {
|
||||
return notInline(fun(b: Boolean) {
|
||||
return@notInline
|
||||
})
|
||||
}
|
||||
+6
@@ -302,6 +302,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/labelAndReceiverForInfix.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("labeledReturnFromNotLabeledUnnamedFunction.kt")
|
||||
public void testLabeledReturnFromNotLabeledUnnamedFunction() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/labeledReturnFromNotLabeledUnnamedFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaArgInScopeFunction.kt")
|
||||
public void testLambdaArgInScopeFunction() throws Exception {
|
||||
|
||||
+6
@@ -305,6 +305,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/labelAndReceiverForInfix.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("labeledReturnFromNotLabeledUnnamedFunction.kt")
|
||||
public void testLabeledReturnFromNotLabeledUnnamedFunction() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/labeledReturnFromNotLabeledUnnamedFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaArgInScopeFunction.kt")
|
||||
public void testLambdaArgInScopeFunction() throws Exception {
|
||||
|
||||
+6
@@ -34413,6 +34413,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inline"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineConstructorOfArray.kt")
|
||||
public void testInlineConstructorOfArray() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inline/inlineConstructorOfArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineOnlySuppressesNothingToInline.kt")
|
||||
public void testInlineOnlySuppressesNothingToInline() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user