[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:
Marco Pennekamp
2023-11-07 17:04:33 +01:00
committed by Space Team
parent 6c7963fe47
commit 88d307d52c
20 changed files with 263 additions and 0 deletions
@@ -0,0 +1,12 @@
// IGNORE_FIR
class SomeClass
@Suppress("CONFLICTING_OVERLOADS")
fun someFun(): SomeClass {
return SomeClass()
}
@Suppress("CONFLICTING_OVERLOADS")
fun someFun() {
}
@@ -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)
@@ -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 ""
}
@@ -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)
@@ -0,0 +1,10 @@
@file:Suppress("CONFLICTING_OVERLOADS")
class SomeClass
fun someFun(): SomeClass {
return SomeClass()
}
fun someFun() {
}
@@ -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)
@@ -0,0 +1,12 @@
class SomeClass
class OtherClass {
@Suppress("CONFLICTING_OVERLOADS")
fun someFun(): SomeClass {
return SomeClass()
}
@Suppress("CONFLICTING_OVERLOADS")
fun someFun() {
}
}
@@ -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)
@@ -0,0 +1,14 @@
class SomeClass
class OtherClass {
class NestedClass {
@Suppress("CONFLICTING_OVERLOADS")
fun someFun(): SomeClass {
return SomeClass()
}
@Suppress("CONFLICTING_OVERLOADS")
fun someFun() {
}
}
}
@@ -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)
@@ -0,0 +1,8 @@
@Deprecated(message = "")
fun foo() {
}
@Suppress("DEPRECATION")
fun bar() {
foo()
}
@@ -0,0 +1 @@
Diagnostics from elements: