[AA] Add tests for diagnostics suppression on top-level declarations and class members
- `testConflictingOverloadsAtTopLevel` is currently disabled in FIR because it fails with a mismatch between diagnostics from the file and the individual elements. It will be enabled in the next commit. ^KT-62899
This commit is contained in:
committed by
Space Team
parent
6c7963fe47
commit
88d307d52c
+46
@@ -117,4 +117,50 @@ public class Fe10IdeNormalAnalysisSourceModuleCollectDiagnosticsTestGenerated ex
|
||||
public void testUnusedDestructuring() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/unusedDestructuring.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppression {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppression() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsAtTopLevel.kt")
|
||||
public void testConflictingOverloadsAtTopLevel() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsAtTopLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsAtTopLevel2.kt")
|
||||
public void testConflictingOverloadsAtTopLevel2() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsAtTopLevel2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsAtTopLevelWithFileSuppression.kt")
|
||||
public void testConflictingOverloadsAtTopLevelWithFileSuppression() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsAtTopLevelWithFileSuppression.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsInClass.kt")
|
||||
public void testConflictingOverloadsInClass() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsInNestedClass.kt")
|
||||
public void testConflictingOverloadsInNestedClass() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("deprecationAtTopLevel.kt")
|
||||
public void testDeprecationAtTopLevel() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/deprecationAtTopLevel.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -45,4 +45,14 @@ public class FirIdeNormalAnalysisScriptSourceModuleCollectDiagnosticsTestGenerat
|
||||
public void testAllFilesPresentInDiagnostics() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics"), Pattern.compile("^(.+)\\.kts$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppression {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppression() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression"), Pattern.compile("^(.+)\\.kts$"), null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+46
@@ -117,4 +117,50 @@ public class FirIdeNormalAnalysisSourceModuleCollectDiagnosticsTestGenerated ext
|
||||
public void testUnusedDestructuring() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/unusedDestructuring.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppression {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppression() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsAtTopLevel.kt")
|
||||
public void testConflictingOverloadsAtTopLevel() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsAtTopLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsAtTopLevel2.kt")
|
||||
public void testConflictingOverloadsAtTopLevel2() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsAtTopLevel2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsAtTopLevelWithFileSuppression.kt")
|
||||
public void testConflictingOverloadsAtTopLevelWithFileSuppression() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsAtTopLevelWithFileSuppression.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsInClass.kt")
|
||||
public void testConflictingOverloadsInClass() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsInNestedClass.kt")
|
||||
public void testConflictingOverloadsInNestedClass() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("deprecationAtTopLevel.kt")
|
||||
public void testDeprecationAtTopLevel() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/deprecationAtTopLevel.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+46
@@ -117,4 +117,50 @@ public class FirStandaloneNormalAnalysisSourceModuleCollectDiagnosticsTestGenera
|
||||
public void testUnusedDestructuring() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/unusedDestructuring.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppression {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppression() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsAtTopLevel.kt")
|
||||
public void testConflictingOverloadsAtTopLevel() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsAtTopLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsAtTopLevel2.kt")
|
||||
public void testConflictingOverloadsAtTopLevel2() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsAtTopLevel2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsAtTopLevelWithFileSuppression.kt")
|
||||
public void testConflictingOverloadsAtTopLevelWithFileSuppression() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsAtTopLevelWithFileSuppression.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsInClass.kt")
|
||||
public void testConflictingOverloadsInClass() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("conflictingOverloadsInNestedClass.kt")
|
||||
public void testConflictingOverloadsInNestedClass() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/conflictingOverloadsInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("deprecationAtTopLevel.kt")
|
||||
public void testDeprecationAtTopLevel() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/suppression/deprecationAtTopLevel.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
Diagnostics from elements:
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// IGNORE_FIR
|
||||
|
||||
class SomeClass
|
||||
|
||||
@Suppress("CONFLICTING_OVERLOADS")
|
||||
fun someFun(): SomeClass {
|
||||
return SomeClass()
|
||||
}
|
||||
|
||||
@Suppress("CONFLICTING_OVERLOADS")
|
||||
fun someFun() {
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Diagnostics from elements:
|
||||
for PSI element of type KtStringTemplateExpression at (10,11-34)
|
||||
ERROR_SUPPRESSION text ranges: [(130,153)]
|
||||
PSI: KtStringTemplateExpression at (10,11-34)
|
||||
for PSI element of type KtStringTemplateExpression at (5,11-34)
|
||||
ERROR_SUPPRESSION text ranges: [(42,65)]
|
||||
PSI: KtStringTemplateExpression at (5,11-34)
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// IGNORE_FIR
|
||||
// In FIR, there is currently a mismatch between the file's diagnostics and the individual elements' diagnostics, so we have to disable the
|
||||
// FIR test. It will be fixed by KT-63221.
|
||||
|
||||
class SomeClass
|
||||
|
||||
fun someFun(): Int {
|
||||
return 5
|
||||
}
|
||||
|
||||
@Suppress("CONFLICTING_OVERLOADS")
|
||||
fun someFun(): SomeClass {
|
||||
return SomeClass()
|
||||
}
|
||||
|
||||
@Suppress("CONFLICTING_OVERLOADS")
|
||||
fun someFun() {
|
||||
}
|
||||
|
||||
fun someFun(): String {
|
||||
return ""
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Diagnostics from elements:
|
||||
for PSI element of type KtNamedFunction at (20,1) - (22,2)
|
||||
CONFLICTING_OVERLOADS text ranges: [(394,415)]
|
||||
PSI: KtNamedFunction at (20,1) - (22,2)
|
||||
for PSI element of type KtNamedFunction at (7,1) - (9,2)
|
||||
CONFLICTING_OVERLOADS text ranges: [(215,233)]
|
||||
PSI: KtNamedFunction at (7,1) - (9,2)
|
||||
+1
@@ -0,0 +1 @@
|
||||
Diagnostics from elements:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
@file:Suppress("CONFLICTING_OVERLOADS")
|
||||
|
||||
class SomeClass
|
||||
|
||||
fun someFun(): SomeClass {
|
||||
return SomeClass()
|
||||
}
|
||||
|
||||
fun someFun() {
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
Diagnostics from elements:
|
||||
for PSI element of type KtStringTemplateExpression at (1,16-39)
|
||||
ERROR_SUPPRESSION text ranges: [(15,38)]
|
||||
PSI: KtStringTemplateExpression at (1,16-39)
|
||||
+1
@@ -0,0 +1 @@
|
||||
Diagnostics from elements:
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class SomeClass
|
||||
|
||||
class OtherClass {
|
||||
@Suppress("CONFLICTING_OVERLOADS")
|
||||
fun someFun(): SomeClass {
|
||||
return SomeClass()
|
||||
}
|
||||
|
||||
@Suppress("CONFLICTING_OVERLOADS")
|
||||
fun someFun() {
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Diagnostics from elements:
|
||||
for PSI element of type KtStringTemplateExpression at (4,15-38)
|
||||
ERROR_SUPPRESSION text ranges: [(50,73)]
|
||||
PSI: KtStringTemplateExpression at (4,15-38)
|
||||
for PSI element of type KtStringTemplateExpression at (9,15-38)
|
||||
ERROR_SUPPRESSION text ranges: [(154,177)]
|
||||
PSI: KtStringTemplateExpression at (9,15-38)
|
||||
+1
@@ -0,0 +1 @@
|
||||
Diagnostics from elements:
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
class SomeClass
|
||||
|
||||
class OtherClass {
|
||||
class NestedClass {
|
||||
@Suppress("CONFLICTING_OVERLOADS")
|
||||
fun someFun(): SomeClass {
|
||||
return SomeClass()
|
||||
}
|
||||
|
||||
@Suppress("CONFLICTING_OVERLOADS")
|
||||
fun someFun() {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Diagnostics from elements:
|
||||
for PSI element of type KtStringTemplateExpression at (10,19-42)
|
||||
ERROR_SUPPRESSION text ranges: [(198,221)]
|
||||
PSI: KtStringTemplateExpression at (10,19-42)
|
||||
for PSI element of type KtStringTemplateExpression at (5,19-42)
|
||||
ERROR_SUPPRESSION text ranges: [(78,101)]
|
||||
PSI: KtStringTemplateExpression at (5,19-42)
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
@Deprecated(message = "")
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
fun bar() {
|
||||
foo()
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Diagnostics from elements:
|
||||
Reference in New Issue
Block a user