FIR checker: introduce PARAMETER_* positioning strategies
and use them to add support diagnostics: ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE USELESS_VARARG_ON_PARAMETER
This commit is contained in:
committed by
Mikhail Glukhikh
parent
33b7c68a21
commit
8b4f2b269c
+18
@@ -1231,6 +1231,24 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
public void testValOnAnnotationParameter() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/valOnAnnotationParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/diagnostics/functionAsExpression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class FunctionAsExpression extends AbstractLazyBodyIsNotTouchedTilContractsPhaseTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFunctionAsExpression() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/diagnostics/functionAsExpression"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("Parameters.kt")
|
||||
public void testParameters() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/functionAsExpression/Parameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/expresssions")
|
||||
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
FILE: Parameters.kt
|
||||
public final val bar: R|(kotlin/Int) -> kotlin/Unit| = fun <anonymous>(p: R|kotlin/Int| = Int(3)): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public get(): R|(kotlin/Int) -> kotlin/Unit|
|
||||
public final val bas: R|(kotlin/Int) -> kotlin/Unit| = fun <anonymous>(vararg p: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public get(): R|(kotlin/Int) -> kotlin/Unit|
|
||||
public final fun gar(): R|(kotlin/Int) -> kotlin/Unit| {
|
||||
^gar fun <anonymous>(p: R|kotlin/Int| = Int(3)): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun gas(): R|(kotlin/Int) -> kotlin/Unit| {
|
||||
^gas fun <anonymous>(vararg p: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun outer(b: R|kotlin/Any?|): R|kotlin/Unit| {
|
||||
lval bar: R|(kotlin/Int) -> kotlin/Unit| = fun <anonymous>(p: R|kotlin/Int| = Int(3)): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
lval bas: R|(kotlin/Int) -> kotlin/Unit| = fun <anonymous>(vararg p: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
local final fun gar(): R|(kotlin/Int) -> kotlin/Unit| {
|
||||
^gar fun <anonymous>(p: R|kotlin/Int| = Int(3)): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
local final fun gas(): R|(kotlin/Int) -> kotlin/Unit| {
|
||||
^gas fun <anonymous>(vararg p: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
R|/outer|(fun <anonymous>(p: R|kotlin/Int| = Int(3)): R|kotlin/Unit| {
|
||||
}
|
||||
)
|
||||
R|/outer|(fun <anonymous>(vararg p: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
)
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
val bar = fun(p: Int = <!ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE!>3<!>) {}
|
||||
val bas = fun(<!USELESS_VARARG_ON_PARAMETER!>vararg p: Int<!>) {}
|
||||
|
||||
fun gar() = fun(p: Int = <!ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE!>3<!>) {}
|
||||
fun gas() = fun(<!USELESS_VARARG_ON_PARAMETER!>vararg p: Int<!>) {}
|
||||
|
||||
fun outer(b: Any?) {
|
||||
val bar = fun(p: Int = <!ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE!>3<!>) {}
|
||||
val bas = fun(<!USELESS_VARARG_ON_PARAMETER!>vararg p: Int<!>) {}
|
||||
|
||||
fun gar() = fun(p: Int = <!ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE!>3<!>) {}
|
||||
fun gas() = fun(<!USELESS_VARARG_ON_PARAMETER!>vararg p: Int<!>) {}
|
||||
|
||||
outer(fun(p: Int = <!ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE!>3<!>) {})
|
||||
outer(fun(<!USELESS_VARARG_ON_PARAMETER!>vararg p: Int<!>) {})
|
||||
}
|
||||
+16
@@ -1424,6 +1424,22 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
public void testValOnAnnotationParameter() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/valOnAnnotationParameter.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/diagnostics/functionAsExpression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FunctionAsExpression extends AbstractFirDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInFunctionAsExpression() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/diagnostics/functionAsExpression"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Parameters.kt")
|
||||
public void testParameters() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/functionAsExpression/Parameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+17
@@ -1433,6 +1433,23 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
public void testValOnAnnotationParameter() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/valOnAnnotationParameter.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/diagnostics/functionAsExpression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class FunctionAsExpression extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInFunctionAsExpression() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/diagnostics/functionAsExpression"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Parameters.kt")
|
||||
public void testParameters() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/functionAsExpression/Parameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user