From 9ea9950d28147d7fff6c311ff4ecf07e4883a0ed Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Tue, 5 Mar 2024 16:26:32 +0100 Subject: [PATCH] [LL FIR] Replace IGNORE_DIAGNOSTIC_API with IGNORE_NON_REVERSED_RESOLVE --- .../AbstractDiagnosticCompilerTestDataTest.kt | 29 ++----------------- .../tests/j+k/primitiveOverrides/removeAt.kt | 2 +- .../manyImplMemberNotImplemented.fir.kt | 2 +- .../scopes/manyImplMemberNotImplemented.kt | 2 +- .../manyInterfacesMemberNotImplemented.fir.kt | 2 +- .../manyInterfacesMemberNotImplemented.kt | 2 +- .../mixedFunctionalTypesInSupertypes.fir.kt | 2 +- .../mixedFunctionalTypesInSupertypes.kt | 2 +- .../scopes/scopeOfFunInterface.fir.kt | 2 +- .../scopes/scopeOfFunInterface.kt | 2 +- .../destructuringDeclarationsScript.fir.kts | 2 +- .../destructuringDeclarationsScript.kts | 2 +- 12 files changed, 13 insertions(+), 38 deletions(-) diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/AbstractDiagnosticCompilerTestDataTest.kt b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/AbstractDiagnosticCompilerTestDataTest.kt index 3cc42806a07..05c5e325ac2 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/AbstractDiagnosticCompilerTestDataTest.kt +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/AbstractDiagnosticCompilerTestDataTest.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based +import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirOnlyNonReversedTestSuppressor import org.jetbrains.kotlin.analysis.low.level.api.fir.compiler.based.AbstractCompilerBasedTestForFir import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.facades.LLFirAnalyzerFacadeFactoryWithoutPreresolve import org.jetbrains.kotlin.fir.symbols.FirLazyResolveContractViolationException @@ -25,7 +26,7 @@ abstract class AbstractDiagnosticCompilerTestDataTest : AbstractCompilerBasedTes testDataConsistencyHandler = ::ReversedFirIdenticalChecker, ) useAfterAnalysisCheckers(::ContractViolationSuppressor) - useAfterAnalysisCheckers(::DiagnosticSuppressor) + useAfterAnalysisCheckers(::LLFirOnlyNonReversedTestSuppressor) } } @@ -55,29 +56,3 @@ private class ContractViolationSuppressor(testServices: TestServices) : AfterAna val IGNORE_CONTRACT_VIOLATIONS by directive("Temporary disables test with contract violation until the issue is fixed") } } - -private class DiagnosticSuppressor(testServices: TestServices) : AfterAnalysisChecker(testServices) { - override val directiveContainers: List get() = listOf(Companion) - - override fun suppressIfNeeded(failedAssertions: List): List { - if (!isDisabled()) { - return failedAssertions - } - - return if (failedAssertions.isEmpty()) { - listOf( - AssertionError( - "Test contains $IGNORE_DIAGNOSTIC_API directive but no errors was reported. Please remove directive", - ).wrap() - ) - } else { - emptyList() - } - } - - private fun isDisabled(): Boolean = IGNORE_DIAGNOSTIC_API in testServices.moduleStructure.allDirectives - - companion object : SimpleDirectivesContainer() { - val IGNORE_DIAGNOSTIC_API by directive("Temporary disables diagnostic api test until the issue is fixed") - } -} diff --git a/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt b/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt index 32d060d996b..db8299bb52b 100644 --- a/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt +++ b/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt @@ -2,7 +2,7 @@ // WITH_STDLIB // SCOPE_DUMP: A:removeAt // ISSUE: KT-65410 -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // IGNORE_REVERSED_RESOLVE // Reason: SCOPE_DUMP uses different parameter names in AA modes diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.fir.kt index c8365afb9ee..2bd2fa99d21 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.fir.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // LANGUAGE: +MultiPlatformProjects -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // IGNORE_REVERSED_RESOLVE // Reason: MPP diagnostics are reported differentely in the compiler and AA diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.kt index 3fbfbd2c62b..3b0576cbb39 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // LANGUAGE: +MultiPlatformProjects -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // IGNORE_REVERSED_RESOLVE // Reason: MPP diagnostics are reported differentely in the compiler and AA diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.fir.kt index 78df967ff40..736f8f5fe29 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.fir.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // !LANGUAGE: +MultiPlatformProjects -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // IGNORE_REVERSED_RESOLVE // Reason: MPP diagnostics are reported differentely in the compiler and AA diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.kt index ca0ecfaef68..60d1548d264 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // !LANGUAGE: +MultiPlatformProjects -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // IGNORE_REVERSED_RESOLVE // Reason: MPP diagnostics are reported differentely in the compiler and AA diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.fir.kt index fd62c17dc3d..6c6dc552ed4 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.fir.kt @@ -1,5 +1,5 @@ // LANGUAGE: +MultiPlatformProjects -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // IGNORE_REVERSED_RESOLVE // Reason: MPP diagnostics are reported differentely in the compiler and AA diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt index 3f74976994c..8c4c1169179 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt @@ -1,5 +1,5 @@ // LANGUAGE: +MultiPlatformProjects -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // IGNORE_REVERSED_RESOLVE // Reason: MPP diagnostics are reported differentely in the compiler and AA diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.fir.kt index 3a9d76bd3b7..7156ae08372 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.fir.kt @@ -1,6 +1,6 @@ // LANGUAGE: +MultiPlatformProjects // ISSUE: KT-58845 -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // IGNORE_REVERSED_RESOLVE // Reason: MPP diagnostics are reported differentely in the compiler and AA diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt index bbbd7a20dd1..13206b0ff8d 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt @@ -1,6 +1,6 @@ // LANGUAGE: +MultiPlatformProjects // ISSUE: KT-58845 -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // IGNORE_REVERSED_RESOLVE // Reason: MPP diagnostics are reported differentely in the compiler and AA diff --git a/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.fir.kts b/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.fir.kts index 5459fe0fbd5..64eff81b489 100644 --- a/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.fir.kts +++ b/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.fir.kts @@ -1,6 +1,6 @@ // !WITH_NEW_INFERENCE // IGNORE_REVERSED_RESOLVE -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // DUMP_CFG: LEVELS // KT-62840 val (a1, a2) = A() diff --git a/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.kts b/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.kts index 46a6a45db9a..a5f387dccc1 100644 --- a/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.kts +++ b/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.kts @@ -1,6 +1,6 @@ // !WITH_NEW_INFERENCE // IGNORE_REVERSED_RESOLVE -// IGNORE_DIAGNOSTIC_API +// IGNORE_NON_REVERSED_RESOLVE // DUMP_CFG: LEVELS // KT-62840 val (a1, a2) = A()