K2: add test with some samples of diagnostic suppression

This commit is contained in:
Mikhail Glukhikh
2022-07-20 14:46:12 +02:00
committed by Space
parent 4284f6b573
commit 179b267d9f
6 changed files with 79 additions and 0 deletions
@@ -4210,6 +4210,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
public void testSingleWarning() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/singleWarning.kt");
}
@Test
@TestMetadata("withSuppression.kt")
public void testWithSuppression() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/withSuppression.kt");
}
}
@Nested
@@ -3758,6 +3758,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
public void testSingleWarning() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/singleWarning.kt");
}
@TestMetadata("withSuppression.kt")
public void testWithSuppression() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/withSuppression.kt");
}
}
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/types")
@@ -0,0 +1,36 @@
FILE: withSuppression.kt
public final const val x: R|kotlin/String| = String(123)
@R|kotlin/Suppress|(names = vararg(String(CONST_VAL_WITH_GETTER))) public get(): R|kotlin/String| {
^ F|/x|
}
public final val y: R|kotlin/String| = String(789)
public get(): R|kotlin/String|
public final const val z: R|kotlin/String| = @R|kotlin/Suppress|(names = vararg(String(CONST_VAL_WITH_NON_CONST_INITIALIZER))) R|/y|
public get(): R|kotlin/String|
@R|kotlin/annotation/Target|(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|)) public final annotation class Ann : R|kotlin/Annotation| {
public constructor(): R|Ann| {
super<R|kotlin/Any|>()
}
}
public final fun foo(): R|@R|kotlin/Suppress|(names = vararg(String(REPEATED_ANNOTATION))) @R|Ann|() @R|Ann|() kotlin/Int| {
^foo Int(42)
}
public final typealias Alias<T> = R|@R|kotlin/Suppress|(names = vararg(String(TYPEALIAS_SHOULD_EXPAND_TO_CLASS))) T|
public abstract interface A : R|kotlin/Any| {
}
public abstract interface B : R|@R|kotlin/Suppress|(names = vararg(String(SUPERTYPE_INITIALIZED_IN_INTERFACE))) A| {
}
public final data class D : R|kotlin/Any| {
@R|kotlin/Suppress|(names = vararg(String(DATA_CLASS_VARARG_PARAMETER))) public constructor(vararg x: R|kotlin/Array<out kotlin/String>|): R|D| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Array<out kotlin/String>| = R|<local>/x|
public get(): R|kotlin/Array<out kotlin/String>|
public final operator fun component1(): R|kotlin/String|
public final fun copy(x: R|kotlin/String| = this@R|/D|.R|/D.x|): R|D|
}
@@ -0,0 +1,20 @@
const val x = "123"
<!CONST_VAL_WITH_GETTER!>@Suppress("CONST_VAL_WITH_GETTER")
get() = field<!>
val y = "789"
const val z = @Suppress("CONST_VAL_WITH_NON_CONST_INITIALIZER") <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>y<!>
@Target(AnnotationTarget.TYPE)
annotation class Ann
fun foo(): @Suppress("REPEATED_ANNOTATION") @Ann <!REPEATED_ANNOTATION!>@Ann<!> Int = 42
typealias Alias<T> = <!TYPEALIAS_SHOULD_EXPAND_TO_CLASS!>@Suppress("TYPEALIAS_SHOULD_EXPAND_TO_CLASS") T<!>
interface A
interface B : <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>@Suppress("SUPERTYPE_INITIALIZED_IN_INTERFACE") A<!>()
data class D @Suppress("DATA_CLASS_VARARG_PARAMETER") constructor(<!DATA_CLASS_VARARG_PARAMETER!>vararg val x: String<!>)
@@ -4210,6 +4210,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
public void testSingleWarning() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/singleWarning.kt");
}
@Test
@TestMetadata("withSuppression.kt")
public void testWithSuppression() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/withSuppression.kt");
}
}
@Nested
@@ -4210,6 +4210,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
public void testSingleWarning() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/singleWarning.kt");
}
@Test
@TestMetadata("withSuppression.kt")
public void testWithSuppression() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/withSuppression.kt");
}
}
@Nested