diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractFirLazyBodiesCalculatorTest.kt b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractFirLazyBodiesCalculatorTest.kt index 4083ded1852..66130316069 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractFirLazyBodiesCalculatorTest.kt +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractFirLazyBodiesCalculatorTest.kt @@ -20,10 +20,17 @@ import org.jetbrains.kotlin.fir.renderer.FirRenderer import org.jetbrains.kotlin.fir.scopes.kotlinScopeProvider import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer import org.jetbrains.kotlin.test.model.TestModule import org.jetbrains.kotlin.test.services.TestServices abstract class AbstractFirLazyBodiesCalculatorTest : AbstractAnalysisApiBasedTest() { + override fun configureTest(builder: TestConfigurationBuilder) { + super.configureTest(builder) + builder.useDirectives(Directives) + } + private val lazyChecker = object : FirVisitorVoid() { override fun visitElement(element: FirElement) { TestCase.assertFalse("${FirLazyBlock::class.qualifiedName} should not present in the tree", element is FirLazyBlock) @@ -33,6 +40,8 @@ abstract class AbstractFirLazyBodiesCalculatorTest : AbstractAnalysisApiBasedTes } override fun doTestByMainFile(mainFile: KtFile, mainModule: TestModule, testServices: TestServices) { + if (Directives.IGNORE_BODY_CALCULATOR in mainModule.directives) return + resolveWithClearCaches(mainFile) { firResolveSession -> val session = firResolveSession.useSiteFirSession val provider = session.kotlinScopeProvider @@ -58,6 +67,10 @@ abstract class AbstractFirLazyBodiesCalculatorTest : AbstractAnalysisApiBasedTes TestCase.assertEquals(/* expected = */ fullFirFileDump, /* actual = */ laziedFirFileDump) } } + + private object Directives : SimpleDirectivesContainer() { + val IGNORE_BODY_CALCULATOR by stringDirective("Ignore body calculator") + } } abstract class AbstractFirSourceLazyBodiesCalculatorTest : AbstractFirLazyBodiesCalculatorTest() { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts index 7077622decb..ef427077453 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts @@ -1,10 +1,15 @@ // IGNORE_TREE_ACCESS: KT-64899 +// IGNORE_BODY_CALCULATOR package util if (true) { @DestrAnno("destr 1 $prop") val (@LeftAnno("a $prop") a, @RightAnno("b $prop") b) = 0 to 1 + run { + println() + } + @Destr2Anno("destr 1 $prop") val (@SecondLeftAnno("c $prop") c, @SecondRightAnno("d $prop") d) = 2 to 3 } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.lazyBodies.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.lazyBodies.txt index f53dca17571..eb5eb28bac2 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.lazyBodies.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.lazyBodies.txt @@ -7,6 +7,7 @@ FILE: scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts @DestrAnno(LAZY_EXPRESSION) lval : = IntegerLiteral(0).to#(IntegerLiteral(1)) @LeftAnno(LAZY_EXPRESSION) lval a: = R|/|.component1#() @RightAnno(LAZY_EXPRESSION) lval b: = R|/|.component2#() + run#( = LAZY_EXPRESSION) @Destr2Anno(LAZY_EXPRESSION) lval : = IntegerLiteral(2).to#(IntegerLiteral(3)) @SecondLeftAnno(LAZY_EXPRESSION) lval c: = R|/|.component1#() @SecondRightAnno(LAZY_EXPRESSION) lval d: = R|/|.component2#() diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.txt index 5cacccd5381..ae13d1570b0 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.txt @@ -7,6 +7,10 @@ FILE: scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts @DestrAnno((String(destr 1 ), prop#)) lval : = IntegerLiteral(0).to#(IntegerLiteral(1)) @LeftAnno((String(a ), prop#)) lval a: = R|/|.component1#() @RightAnno((String(b ), prop#)) lval b: = R|/|.component2#() + run#( = run@fun .(): { + println#() + } + ) @Destr2Anno((String(destr 1 ), prop#)) lval : = IntegerLiteral(2).to#(IntegerLiteral(3)) @SecondLeftAnno((String(c ), prop#)) lval c: = R|/|.component1#() @SecondRightAnno((String(d ), prop#)) lval d: = R|/|.component2#()