[FIR] Check test text for all alongside tests

For some reason the practice is to configure the K2
diagnostics tests as "alongside" and instruct K1
tests to ensure there are no unexpected differences
in the sources. But someone may still forget there is
something that they need to configure in the K1 runners.
This commit is contained in:
Nikolay Lunyak
2023-10-02 14:06:16 +03:00
committed by Space Team
parent d803e0e31c
commit cca04bbcc2
6 changed files with 19 additions and 7 deletions
@@ -20,7 +20,10 @@ import org.jetbrains.kotlin.test.services.moduleStructure
abstract class AbstractDiagnosticCompilerTestDataTest : AbstractCompilerBasedTestForFir() {
override fun TestConfigurationBuilder.configureTest() {
baseFirDiagnosticTestConfiguration(frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve))
baseFirDiagnosticTestConfiguration(
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve),
testDataConsistencyHandler = ::ReversedFirIdenticalChecker,
)
useAfterAnalysisCheckers(::ContractViolationSuppressor)
useAfterAnalysisCheckers(::DiagnosticSuppressor)
}
@@ -26,12 +26,12 @@ import org.jetbrains.kotlin.test.utils.llFirTestDataFile
abstract class AbstractLLFirPreresolvedReversedDiagnosticCompilerTestDataTest : AbstractCompilerBasedTestForFir() {
override fun TestConfigurationBuilder.configureTest() {
baseFirDiagnosticTestConfiguration(
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder)
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder),
testDataConsistencyHandler = ::ReversedFirIdenticalChecker,
)
useAfterAnalysisCheckers(::FirReversedSuppressor)
useMetaTestConfigurators(::ReversedDiagnosticsConfigurator)
useAfterAnalysisCheckers(::ReversedFirIdenticalChecker)
}
}
@@ -11,10 +11,11 @@ open class ProtectedInsideInlineError : ProtectedInsideInlineParent() {
protected var protectedVar = 0
protected fun protectedFun() = 0
<!NOTHING_TO_INLINE!>inline<!> fun publicInlineUserFun() {
<!NOTHING_TO_INLINE!>inline<!> fun publicInlineUserFun(): Int {
println(<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedVar<!> + <!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedParentVar<!>)
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedFun<!>()
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedParentFun<!>()
return <!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedVar<!> + <!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedParentVar<!>
}
inline var publicInlineUserVal: Int
@@ -12,6 +12,7 @@ open class ProtectedInsideInlineError : ProtectedInsideInlineParent() {
protected fun protectedFun() = 0
inline fun publicInlineUserFun(): Int {
println(<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedVar<!> + <!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedParentVar<!>)
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedFun<!>()
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedParentFun<!>()
return <!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedVar<!> + <!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedParentVar<!>
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: +ENUM_CLASS_IN_EXTERNAL_DECLARATION_WARNING
external enum class <!ENUM_CLASS_IN_EXTERNAL_DECLARATION_WARNING!>E<!> {
X,
Y <!EXTERNAL_ENUM_ENTRY_WITH_BODY!>{
@@ -27,8 +27,10 @@ import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.ALLOW_KOTLIN_PACKAGE
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.LANGUAGE
import org.jetbrains.kotlin.test.directives.configureFirParser
import org.jetbrains.kotlin.test.frontend.classic.handlers.FirTestDataConsistencyHandler
import org.jetbrains.kotlin.test.frontend.fir.*
import org.jetbrains.kotlin.test.frontend.fir.handlers.*
import org.jetbrains.kotlin.test.model.AfterAnalysisChecker
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendFacade
import org.jetbrains.kotlin.test.model.FrontendKinds
@@ -114,10 +116,13 @@ open class AbstractFirPsiWithActualizerDiagnosticsTest : AbstractFirWithActualiz
open class AbstractFirLightTreeWithActualizerDiagnosticsTest : AbstractFirWithActualizerDiagnosticsTest(FirParser.LightTree)
fun TestConfigurationBuilder.configurationForClassicAndFirTestsAlongside() {
fun TestConfigurationBuilder.configurationForClassicAndFirTestsAlongside(
testDataConsistencyHandler: Constructor<AfterAnalysisChecker> = ::FirTestDataConsistencyHandler,
) {
useAfterAnalysisCheckers(
::FirIdenticalChecker,
::FirFailingTestSuppressor,
testDataConsistencyHandler,
)
useMetaTestConfigurators(::FirOldFrontendMetaConfigurator)
}
@@ -125,7 +130,8 @@ fun TestConfigurationBuilder.configurationForClassicAndFirTestsAlongside() {
// `baseDir` is used in Kotlin plugin from IJ infra
fun TestConfigurationBuilder.baseFirDiagnosticTestConfiguration(
baseDir: String = ".",
frontendFacade: Constructor<FrontendFacade<FirOutputArtifact>> = ::FirFrontendFacade
frontendFacade: Constructor<FrontendFacade<FirOutputArtifact>> = ::FirFrontendFacade,
testDataConsistencyHandler: Constructor<AfterAnalysisChecker> = ::FirTestDataConsistencyHandler,
) {
globalDefaults {
frontend = FrontendKinds.FIR
@@ -160,7 +166,7 @@ fun TestConfigurationBuilder.baseFirDiagnosticTestConfiguration(
useMetaInfoProcessors(::PsiLightTreeMetaInfoProcessor)
forTestsMatching("compiler/testData/diagnostics/*") {
configurationForClassicAndFirTestsAlongside()
configurationForClassicAndFirTestsAlongside(testDataConsistencyHandler)
}
forTestsMatching("compiler/fir/analysis-tests/testData/*") {