[LL FIR] AbstractCompilerBasedTestForFir: convert receiver to parameter

to allow using super call from implementations

^KT-66232
This commit is contained in:
Dmitrii Gridin
2024-03-01 15:36:05 +01:00
committed by Space Team
parent 4b5eac7816
commit d6b3f6f352
8 changed files with 82 additions and 60 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -19,29 +19,34 @@ import org.jetbrains.kotlin.test.runners.configurationForClassicAndFirTestsAlong
import org.jetbrains.kotlin.utils.bind
abstract class AbstractLLFirNativeTestBase : AbstractCompilerBasedTestForFir() {
override fun configureTest(builder: TestConfigurationBuilder) {
with(builder) {
globalDefaults {
targetPlatform = NativePlatforms.unspecifiedNativePlatform
}
protected fun TestConfigurationBuilder.baseConfiguration() {
globalDefaults {
targetPlatform = NativePlatforms.unspecifiedNativePlatform
baseFirNativeDiagnosticTestConfiguration()
configurationForClassicAndFirTestsAlongside(::ReversedFirIdenticalChecker)
}
baseFirNativeDiagnosticTestConfiguration()
configurationForClassicAndFirTestsAlongside(::ReversedFirIdenticalChecker)
}
}
abstract class AbstractLLFirNativeTest : AbstractLLFirNativeTestBase() {
override fun TestConfigurationBuilder.configureTest() {
baseNativeDiagnosticTestConfiguration(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve))
baseConfiguration()
useAfterAnalysisCheckers(::LLFirOnlyNonReversedTestSuppressor)
override fun configureTest(builder: TestConfigurationBuilder) {
with(builder) {
baseNativeDiagnosticTestConfiguration(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve))
super.configureTest(builder)
useAfterAnalysisCheckers(::LLFirOnlyNonReversedTestSuppressor)
}
}
}
abstract class AbstractLLFirReversedNativeTest : AbstractLLFirNativeTestBase() {
override fun TestConfigurationBuilder.configureTest() {
baseNativeDiagnosticTestConfiguration(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder))
baseConfiguration()
useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor)
override fun configureTest(builder: TestConfigurationBuilder) {
with(builder) {
baseNativeDiagnosticTestConfiguration(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder))
super.configureTest(builder)
useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor)
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -49,7 +49,7 @@ abstract class AbstractCompilerBasedTestForFir : AbstractCompilerBasedTest() {
}
FirLowLevelCompilerBasedTestConfigurator.configureTest(this, disposable)
configureTest()
configureTest(this)
defaultConfiguration(this)
registerAnalysisApiBaseTestServices(disposable, FirLowLevelCompilerBasedTestConfigurator)
useDirectives(SealedClassesInheritorsCalculatorPreAnalysisHandler.Directives)
@@ -72,7 +72,7 @@ abstract class AbstractCompilerBasedTestForFir : AbstractCompilerBasedTest() {
useAfterAnalysisCheckers(::LLFirTestSuppressor)
}
open fun TestConfigurationBuilder.configureTest() {}
abstract fun configureTest(builder: TestConfigurationBuilder)
inner class LowLevelFirFrontendFacade(
testServices: TestServices,
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -20,13 +20,16 @@ import org.jetbrains.kotlin.test.services.moduleStructure
import org.jetbrains.kotlin.utils.bind
abstract class AbstractDiagnosticCompilerTestDataTest : AbstractCompilerBasedTestForFir() {
override fun TestConfigurationBuilder.configureTest() {
baseFirDiagnosticTestConfiguration(
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve),
testDataConsistencyHandler = ::ReversedFirIdenticalChecker,
)
useAfterAnalysisCheckers(::ContractViolationSuppressor)
useAfterAnalysisCheckers(::LLFirOnlyNonReversedTestSuppressor)
override fun configureTest(builder: TestConfigurationBuilder) {
with(builder) {
baseFirDiagnosticTestConfiguration(
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve),
testDataConsistencyHandler = ::ReversedFirIdenticalChecker,
)
useAfterAnalysisCheckers(::ContractViolationSuppressor)
useAfterAnalysisCheckers(::LLFirOnlyNonReversedTestSuppressor)
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -11,9 +11,11 @@ import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.utils.bind
abstract class AbstractLLFirBlackBoxCodegenBasedTest : AbstractLLFirBlackBoxCodegenBasedTestBase() {
override fun TestConfigurationBuilder.configureTest() {
facadeStep(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve))
baseConfiguration()
useAfterAnalysisCheckers(::LLFirOnlyNonReversedTestSuppressor)
override fun configureTest(builder: TestConfigurationBuilder) {
with(builder) {
facadeStep(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve))
baseConfiguration()
useAfterAnalysisCheckers(::LLFirOnlyNonReversedTestSuppressor)
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -13,9 +13,14 @@ import org.jetbrains.kotlin.test.runners.baseFirSpecDiagnosticTestConfiguration
import org.jetbrains.kotlin.utils.bind
abstract class AbstractLLFirDiagnosticCompilerTestDataSpecTest : AbstractCompilerBasedTestForFir() {
override fun TestConfigurationBuilder.configureTest() {
baseFirDiagnosticTestConfiguration(frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve))
baseFirSpecDiagnosticTestConfigurationForIde()
override fun configureTest(builder: TestConfigurationBuilder) {
with(builder) {
baseFirDiagnosticTestConfiguration(
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve),
)
baseFirSpecDiagnosticTestConfigurationForIde()
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -13,13 +13,16 @@ import org.jetbrains.kotlin.test.runners.baseFirDiagnosticTestConfiguration
import org.jetbrains.kotlin.utils.bind
abstract class AbstractLLFirPreresolvedReversedDiagnosticCompilerTestDataSpecTest : AbstractCompilerBasedTestForFir() {
override fun TestConfigurationBuilder.configureTest() {
baseFirDiagnosticTestConfiguration(
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder)
)
baseFirSpecDiagnosticTestConfigurationForIde()
useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor)
useMetaTestConfigurators(::ReversedDiagnosticsConfigurator)
useAfterAnalysisCheckers(::ReversedFirIdenticalChecker)
override fun configureTest(builder: TestConfigurationBuilder) {
with(builder) {
baseFirDiagnosticTestConfiguration(
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder),
)
baseFirSpecDiagnosticTestConfigurationForIde()
useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor)
useMetaTestConfigurators(::ReversedDiagnosticsConfigurator)
useAfterAnalysisCheckers(::ReversedFirIdenticalChecker)
}
}
}
@@ -1,33 +1,35 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based
import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirOnlyReversedTestSuppressor
import java.io.File
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.LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.runners.baseFirDiagnosticTestConfiguration
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.frontend.fir.handlers.AbstractFirIdenticalChecker
import org.jetbrains.kotlin.test.runners.baseFirDiagnosticTestConfiguration
import org.jetbrains.kotlin.test.services.MetaTestConfigurator
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.assertions
import org.jetbrains.kotlin.test.utils.firTestDataFile
import org.jetbrains.kotlin.test.utils.llFirTestDataFile
import org.jetbrains.kotlin.utils.bind
import java.io.File
abstract class AbstractLLFirPreresolvedReversedDiagnosticCompilerTestDataTest : AbstractCompilerBasedTestForFir() {
override fun TestConfigurationBuilder.configureTest() {
baseFirDiagnosticTestConfiguration(
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder),
testDataConsistencyHandler = ::ReversedFirIdenticalChecker,
)
override fun configureTest(builder: TestConfigurationBuilder) {
with(builder) {
baseFirDiagnosticTestConfiguration(
frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder),
testDataConsistencyHandler = ::ReversedFirIdenticalChecker,
)
useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor)
useMetaTestConfigurators(::ReversedDiagnosticsConfigurator)
useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor)
useMetaTestConfigurators(::ReversedDiagnosticsConfigurator)
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -11,9 +11,11 @@ import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.utils.bind
abstract class AbstractLLFirReversedBlackBoxCodegenBasedTest : AbstractLLFirBlackBoxCodegenBasedTestBase() {
override fun TestConfigurationBuilder.configureTest() {
facadeStep(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder))
baseConfiguration()
useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor)
override fun configureTest(builder: TestConfigurationBuilder) {
with(builder) {
facadeStep(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder))
baseConfiguration()
useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor)
}
}
}