[PSI2FIR] split AbstractRawFirBuilderLazyBodiesTestCase on ast and stub versions

This commit explicitly splits raw fir builder in lazy mode on
AST and stubs.
By default, in tests we have an AST tree loaded, so all our
`disallowTreeLoading` is useless in unit tests mode

^KT-64646 Fixed
^KT-64898
^KT-64899
^KT-64900
^KT-64901
This commit is contained in:
Dmitrii Gridin
2024-01-11 16:17:17 +01:00
committed by Space Team
parent 459a8368a6
commit 2c0cf9cad8
20 changed files with 900 additions and 18 deletions
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64898
import kotlin.reflect.KProperty
annotation class Ann
@@ -0,0 +1,7 @@
FILE: classLevelDestructuringWithAnnotation.kt
public final? class Foo : R|kotlin/Any| {
public? constructor(): R|util/Foo| {
LAZY_super<R|kotlin/Any|>
}
}
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64898
@Anno("Derived $x")
data class Derived @Anno("Derived constructor $x") constructor(
@Anno("b $x")
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64898
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64898
@Anno("x annotation $x")
val x: Int by lazy { 1 + 2 }
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64898
import kotlin.reflect.KProperty
fun String.getValue(x: Any?, y: KProperty<*>) = ""
@@ -0,0 +1,7 @@
FILE: invalidDestructing.kt
public final? class A : R|kotlin/Any| {
public? constructor(): R|A| {
LAZY_super<R|kotlin/Any|>
}
}
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64899
class Builder {
var version: String = ""
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64899
package util
@DestrAnno("destr 1 $prop")
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64899
package util
if (true) {
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64899
package util
if (true) {
@@ -0,0 +1 @@
FILE: topLevelDestructuringWithAnnotation.kt
@@ -1,3 +1,4 @@
// IGNORE_TREE_ACCESS: KT-64898
private val nonLocalProperty: List<XXX> by lazy {
val localProperty = mutableListOf<KtLightField>()
localProperty
@@ -20,7 +20,7 @@ import java.util.regex.Pattern;
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuilderLazyBodiesTestCase {
public class RawFirBuilderLazyBodiesByAstTestGenerated extends AbstractRawFirBuilderLazyBodiesByAstTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
@@ -32,7 +32,7 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Declarations extends AbstractRawFirBuilderLazyBodiesTestCase {
public static class Declarations extends AbstractRawFirBuilderLazyBodiesByAstTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
@@ -414,7 +414,7 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Contracts extends AbstractRawFirBuilderLazyBodiesTestCase {
public static class Contracts extends AbstractRawFirBuilderLazyBodiesByAstTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
@@ -426,7 +426,7 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class NewSyntax extends AbstractRawFirBuilderLazyBodiesTestCase {
public static class NewSyntax extends AbstractRawFirBuilderLazyBodiesByAstTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
@@ -454,7 +454,7 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class OldSyntax extends AbstractRawFirBuilderLazyBodiesTestCase {
public static class OldSyntax extends AbstractRawFirBuilderLazyBodiesByAstTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
@@ -473,7 +473,7 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class NoParameterType extends AbstractRawFirBuilderLazyBodiesTestCase {
public static class NoParameterType extends AbstractRawFirBuilderLazyBodiesByAstTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
@@ -547,7 +547,7 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Expressions extends AbstractRawFirBuilderLazyBodiesTestCase {
public static class Expressions extends AbstractRawFirBuilderLazyBodiesByAstTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
@@ -0,0 +1,739 @@
/*
* 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.fir.builder;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.test.generators.GenerateCompilerTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class RawFirBuilderLazyBodiesByStubTestGenerated extends AbstractRawFirBuilderLazyBodiesByStubTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
public void testAllFilesPresentInRawBuilder() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Declarations extends AbstractRawFirBuilderLazyBodiesByStubTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
public void testAllFilesPresentInDeclarations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("annotation.kt")
public void testAnnotation() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt");
}
@TestMetadata("annotationOnField.kt")
public void testAnnotationOnField() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnField.kt");
}
@TestMetadata("annotationOnProperty.kt")
public void testAnnotationOnProperty() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnProperty.kt");
}
@TestMetadata("annotationOnSuperType.kt")
public void testAnnotationOnSuperType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperType.kt");
}
@TestMetadata("annotationOnSuperTypeCall.kt")
public void testAnnotationOnSuperTypeCall() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperTypeCall.kt");
}
@TestMetadata("annotationsOnNullableParenthesizedTypes.kt")
public void testAnnotationsOnNullableParenthesizedTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnNullableParenthesizedTypes.kt");
}
@TestMetadata("annotationsOnParenthesizedTypes.kt")
public void testAnnotationsOnParenthesizedTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt");
}
@TestMetadata("anonymousObjectWithAnnotation.kt")
public void testAnonymousObjectWithAnnotation() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/anonymousObjectWithAnnotation.kt");
}
@TestMetadata("classLevelDestructuringWithAnnotation.kt")
public void testClassLevelDestructuringWithAnnotation() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classLevelDestructuringWithAnnotation.kt");
}
@TestMetadata("classWithWrongSuperCall.kt")
public void testClassWithWrongSuperCall() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt");
}
@TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt");
}
@TestMetadata("constructorInObject.kt")
public void testConstructorInObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorInObject.kt");
}
@TestMetadata("constructorOfAnonymousObject.kt")
public void testConstructorOfAnonymousObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt");
}
@TestMetadata("constructorWithAnnotations.kt")
public void testConstructorWithAnnotations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorWithAnnotations.kt");
}
@TestMetadata("constructorWithLocalDeclarations.kt")
public void testConstructorWithLocalDeclarations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorWithLocalDeclarations.kt");
}
@TestMetadata("contextReceivers.kt")
public void testContextReceivers() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contextReceivers.kt");
}
@TestMetadata("danglingAnnotationsClassLevel.kt")
public void testDanglingAnnotationsClassLevel() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsClassLevel.kt");
}
@TestMetadata("danglingAnnotationsFileLevel.kt")
public void testDanglingAnnotationsFileLevel() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsFileLevel.kt");
}
@TestMetadata("danglingConstrants.kt")
public void testDanglingConstrants() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingConstrants.kt");
}
@TestMetadata("dataClassWithAnnotations.kt")
public void testDataClassWithAnnotations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/dataClassWithAnnotations.kt");
}
@TestMetadata("delegatedFieldNestedName.kt")
public void testDelegatedFieldNestedName() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatedFieldNestedName.kt");
}
@TestMetadata("delegates.kt")
public void testDelegates() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt");
}
@TestMetadata("delegatesWithAnnotations.kt")
public void testDelegatesWithAnnotations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatesWithAnnotations.kt");
}
@TestMetadata("derivedClass.kt")
public void testDerivedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt");
}
@TestMetadata("emptyAnonymousObject.kt")
public void testEmptyAnonymousObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/emptyAnonymousObject.kt");
}
@TestMetadata("enumEntryWithAnnotations.kt")
public void testEnumEntryWithAnnotations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enumEntryWithAnnotations.kt");
}
@TestMetadata("enums.kt")
public void testEnums() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums.kt");
}
@TestMetadata("enums2.kt")
public void testEnums2() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums2.kt");
}
@TestMetadata("enums3.kt")
public void testEnums3() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums3.kt");
}
@TestMetadata("expectActual.kt")
public void testExpectActual() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt");
}
@TestMetadata("expectClassesAndFunctions.kt")
public void testExpectClassesAndFunctions() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectClassesAndFunctions.kt");
}
@TestMetadata("expectNestedAnnotationClassWithConstructorParameter.kt")
public void testExpectNestedAnnotationClassWithConstructorParameter() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectNestedAnnotationClassWithConstructorParameter.kt");
}
@TestMetadata("expectNestedClassMembers.kt")
public void testExpectNestedClassMembers() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectNestedClassMembers.kt");
}
@TestMetadata("expectNestedEnumClassGeneratedMembers.kt")
public void testExpectNestedEnumClassGeneratedMembers() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectNestedEnumClassGeneratedMembers.kt");
}
@TestMetadata("external.kt")
public void testExternal() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt");
}
@TestMetadata("F.kt")
public void testF() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt");
}
@TestMetadata("fileAnnotations.kt")
public void testFileAnnotations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotations.kt");
}
@TestMetadata("fileAnnotationsWithoutPackage.kt")
public void testFileAnnotationsWithoutPackage() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotationsWithoutPackage.kt");
}
@TestMetadata("functionTypes.kt")
public void testFunctionTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt");
}
@TestMetadata("functionWithAnnotations.kt")
public void testFunctionWithAnnotations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionWithAnnotations.kt");
}
@TestMetadata("genericFunctions.kt")
public void testGenericFunctions() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericFunctions.kt");
}
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
}
@TestMetadata("incompletePropertyWithDelegate.kt")
public void testIncompletePropertyWithDelegate() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/incompletePropertyWithDelegate.kt");
}
@TestMetadata("initBlockWithDeclarations.kt")
public void testInitBlockWithDeclarations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initBlockWithDeclarations.kt");
}
@TestMetadata("initWithLocalDeclarations.kt")
public void testInitWithLocalDeclarations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initWithLocalDeclarations.kt");
}
@TestMetadata("invalidDestructing.kt")
public void testInvalidDestructing() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/invalidDestructing.kt");
}
@TestMetadata("kotlinAny.kt")
public void testKotlinAny() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/kotlinAny.kt");
}
@TestMetadata("kotlinAnyNonTopLevel.kt")
public void testKotlinAnyNonTopLevel() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/kotlinAnyNonTopLevel.kt");
}
@TestMetadata("localAnnotations.kt")
public void testLocalAnnotations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localAnnotations.kt");
}
@TestMetadata("localDeclarationsInEnumEntry.kt")
public void testLocalDeclarationsInEnumEntry() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localDeclarationsInEnumEntry.kt");
}
@TestMetadata("localImplicitType.kt")
public void testLocalImplicitType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localImplicitType.kt");
}
@TestMetadata("multiDeclarations.kt")
public void testMultiDeclarations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/multiDeclarations.kt");
}
@TestMetadata("nestedClass.kt")
public void testNestedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/nestedClass.kt");
}
@TestMetadata("NestedOfAliasedType.kt")
public void testNestedOfAliasedType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedOfAliasedType.kt");
}
@TestMetadata("NestedSuperType.kt")
public void testNestedSuperType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedSuperType.kt");
}
@TestMetadata("noPrimaryConstructor.kt")
public void testNoPrimaryConstructor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noPrimaryConstructor.kt");
}
@TestMetadata("propertyWithBackingField.kt")
public void testPropertyWithBackingField() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/propertyWithBackingField.kt");
}
@TestMetadata("propertyWithBackingFieldDifferentTypes.kt")
public void testPropertyWithBackingFieldDifferentTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/propertyWithBackingFieldDifferentTypes.kt");
}
@TestMetadata("script.kts")
public void testScript() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/script.kts");
}
@TestMetadata("scriptLevelDestructuringWithAnnotation.kts")
public void testScriptLevelDestructuringWithAnnotation() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptLevelDestructuringWithAnnotation.kts");
}
@TestMetadata("scriptStatementLevelDestructuringWithAnnotation.kts")
public void testScriptStatementLevelDestructuringWithAnnotation() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotation.kts");
}
@TestMetadata("scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts")
public void testScriptStatementLevelDestructuringWithAnnotationAsLastStatement() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts");
}
@TestMetadata("secondaryConstructor.kt")
public void testSecondaryConstructor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/secondaryConstructor.kt");
}
@TestMetadata("simpleClass.kt")
public void testSimpleClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleClass.kt");
}
@TestMetadata("simpleFun.kt")
public void testSimpleFun() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleFun.kt");
}
@TestMetadata("simpleTypeAlias.kt")
public void testSimpleTypeAlias() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleTypeAlias.kt");
}
@TestMetadata("splitModifierList.kt")
public void testSplitModifierList() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/splitModifierList.kt");
}
@TestMetadata("suspendFunctionTypes.kt")
public void testSuspendFunctionTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/suspendFunctionTypes.kt");
}
@TestMetadata("topLevelDestructuringWithAnnotation.kt")
public void testTopLevelDestructuringWithAnnotation() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/topLevelDestructuringWithAnnotation.kt");
}
@TestMetadata("typeAliasWithGeneric.kt")
public void testTypeAliasWithGeneric() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeAliasWithGeneric.kt");
}
@TestMetadata("typeParameterVsNested.kt")
public void testTypeParameterVsNested() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.kt");
}
@TestMetadata("typeParameters.kt")
public void testTypeParameters() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameters.kt");
}
@TestMetadata("userAny.kt")
public void testUserAny() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/userAny.kt");
}
@TestMetadata("where.kt")
public void testWhere() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/where.kt");
}
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Contracts extends AbstractRawFirBuilderLazyBodiesByStubTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
public void testAllFilesPresentInContracts() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class NewSyntax extends AbstractRawFirBuilderLazyBodiesByStubTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
public void testAllFilesPresentInNewSyntax() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("functionWithBothOldAndNewSyntaxContractDescription.kt")
public void testFunctionWithBothOldAndNewSyntaxContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt");
}
@TestMetadata("propertyAccessorsContractDescription.kt")
public void testPropertyAccessorsContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt");
}
@TestMetadata("simpleFunctionsContractDescription.kt")
public void testSimpleFunctionsContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt");
}
}
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class OldSyntax extends AbstractRawFirBuilderLazyBodiesByStubTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
public void testAllFilesPresentInOldSyntax() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("contractDescription.kt")
public void testContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt");
}
}
}
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class NoParameterType extends AbstractRawFirBuilderLazyBodiesByStubTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
public void testAllFilesPresentInNoParameterType() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("noParameterTypRefInCatch.kt")
public void testNoParameterTypRefInCatch() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt");
}
@TestMetadata("noParameterTypRefInFuncionalType.kt")
public void testNoParameterTypRefInFuncionalType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt");
}
@TestMetadata("noParameterTypRefInFunction.kt")
public void testNoParameterTypRefInFunction() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt");
}
@TestMetadata("noParameterTypRefInLambda.kt")
public void testNoParameterTypRefInLambda() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt");
}
@TestMetadata("noParameterTypRefInPrimaryConstructor.kt")
public void testNoParameterTypRefInPrimaryConstructor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt");
}
@TestMetadata("noParameterTypRefInPrimaryConstructorWithVararg.kt")
public void testNoParameterTypRefInPrimaryConstructorWithVararg() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructorWithVararg.kt");
}
@TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt")
public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt");
}
@TestMetadata("noParameterTypRefInPrimaryConsturctorValWithVararg.kt")
public void testNoParameterTypRefInPrimaryConsturctorValWithVararg() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorValWithVararg.kt");
}
@TestMetadata("noParameterTypRefInSecondaryConstructor.kt")
public void testNoParameterTypRefInSecondaryConstructor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt");
}
@TestMetadata("noParameterTypRefInSetter.kt")
public void testNoParameterTypRefInSetter() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt");
}
@TestMetadata("uncompletedTypRefInPrimaryConstructorWithVararg.kt")
public void testUncompletedTypRefInPrimaryConstructorWithVararg() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/uncompletedTypRefInPrimaryConstructorWithVararg.kt");
}
@TestMetadata("uncompletedTypRefInPrimaryConsturctorValWithVararg.kt")
public void testUncompletedTypRefInPrimaryConsturctorValWithVararg() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/uncompletedTypRefInPrimaryConsturctorValWithVararg.kt");
}
}
}
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Expressions extends AbstractRawFirBuilderLazyBodiesByStubTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
}
public void testAllFilesPresentInExpressions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("annotated.kt")
public void testAnnotated() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt");
}
@TestMetadata("arrayAccess.kt")
public void testArrayAccess() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAccess.kt");
}
@TestMetadata("arrayAssignment.kt")
public void testArrayAssignment() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAssignment.kt");
}
@TestMetadata("branches.kt")
public void testBranches() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/branches.kt");
}
@TestMetadata("callableReferences.kt")
public void testCallableReferences() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/callableReferences.kt");
}
@TestMetadata("calls.kt")
public void testCalls() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt");
}
@TestMetadata("cascadeIf.kt")
public void testCascadeIf() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/cascadeIf.kt");
}
@TestMetadata("classReference.kt")
public void testClassReference() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/classReference.kt");
}
@TestMetadata("collectionLiterals.kt")
public void testCollectionLiterals() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.kt");
}
@TestMetadata("destructuring.kt")
public void testDestructuring() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.kt");
}
@TestMetadata("for.kt")
public void testFor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.kt");
}
@TestMetadata("genericCalls.kt")
public void testGenericCalls() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/genericCalls.kt");
}
@TestMetadata("in.kt")
public void testIn() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/in.kt");
}
@TestMetadata("inBrackets.kt")
public void testInBrackets() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/inBrackets.kt");
}
@TestMetadata("init.kt")
public void testInit() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/init.kt");
}
@TestMetadata("invalidWhen.kt")
public void testInvalidWhen() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/invalidWhen.kt");
}
@TestMetadata("labelForInfix.kt")
public void testLabelForInfix() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/labelForInfix.kt");
}
@TestMetadata("lambda.kt")
public void testLambda() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.kt");
}
@TestMetadata("lambdaAndAnonymousFunction.kt")
public void testLambdaAndAnonymousFunction() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt");
}
@TestMetadata("localDeclarationWithExpression.kt")
public void testLocalDeclarationWithExpression() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/localDeclarationWithExpression.kt");
}
@TestMetadata("locals.kt")
public void testLocals() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt");
}
@TestMetadata("modifications.kt")
public void testModifications() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/modifications.kt");
}
@TestMetadata("namedArgument.kt")
public void testNamedArgument() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/namedArgument.kt");
}
@TestMetadata("nullability.kt")
public void testNullability() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/nullability.kt");
}
@TestMetadata("qualifierWithTypeArguments.kt")
public void testQualifierWithTypeArguments() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt");
}
@TestMetadata("safeCallsWithAssignment.kt")
public void testSafeCallsWithAssignment() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAssignment.kt");
}
@TestMetadata("safeCallsWithAugmentedAssignment.kt")
public void testSafeCallsWithAugmentedAssignment() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAugmentedAssignment.kt");
}
@TestMetadata("safeCallsWithUnaryOperators.kt")
public void testSafeCallsWithUnaryOperators() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.kt");
}
@TestMetadata("simpleReturns.kt")
public void testSimpleReturns() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/simpleReturns.kt");
}
@TestMetadata("super.kt")
public void testSuper() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/super.kt");
}
@TestMetadata("these.kt")
public void testThese() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/these.kt");
}
@TestMetadata("try.kt")
public void testTry() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/try.kt");
}
@TestMetadata("typeOperators.kt")
public void testTypeOperators() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/typeOperators.kt");
}
@TestMetadata("unary.kt")
public void testUnary() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.kt");
}
@TestMetadata("variables.kt")
public void testVariables() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/variables.kt");
}
@TestMetadata("while.kt")
public void testWhile() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/while.kt");
}
}
}
@@ -0,0 +1,17 @@
/*
* 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.fir.builder
import org.jetbrains.kotlin.psi.KtFile
abstract class AbstractRawFirBuilderLazyBodiesByAstTest : AbstractRawFirBuilderLazyBodiesTestCase() {
override fun createKtFile(filePath: String): KtFile {
val file = super.createKtFile(filePath)
file.calcTreeElement()
assertNotNull("Ast tree for the file must be not null", file.treeElement)
return file
}
}
@@ -0,0 +1,77 @@
/*
* 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.fir.builder
import com.intellij.openapi.vfs.VirtualFileFilter
import com.intellij.psi.SingleRootFileViewProvider
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.stubs.KotlinFileStub
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import java.io.File
abstract class AbstractRawFirBuilderLazyBodiesByStubTest : AbstractRawFirBuilderLazyBodiesTestCase() {
override fun doRawFirTest(filePath: String) {
val ignoreTreeAccess = InTextDirectivesUtils.isDirectiveDefined(File(filePath).readText(), "// IGNORE_TREE_ACCESS:")
var treeAccessFound = false
try {
super.doRawFirTest(filePath)
} catch (e: Throwable) {
/**
* @see com.intellij.psi.impl.source.PsiFileImpl.reportProhibitedAstAccess
*/
if (!ignoreTreeAccess || e.message?.startsWith("Access to tree elements not allowed for") != true) {
throw e
}
treeAccessFound = true
}
assertEquals("The tree access is not detected. 'IGNORE_TREE_ACCESS' have to be dropped", ignoreTreeAccess, treeAccessFound)
}
override fun createKtFile(filePath: String): KtFile {
val originalFile = super.createKtFile(filePath)
val originalProvider = originalFile.viewProvider
val updatedProvider = object : SingleRootFileViewProvider(
originalProvider.manager,
originalProvider.virtualFile,
originalProvider.isEventSystemEnabled,
originalProvider.fileType,
) {
/**
* This flag is required to treat the file as physical, as we build stubs only for physical files.
* The problem is that the file is physical itself, but the original provider is not.
*
* @see com.intellij.psi.AbstractFileViewProvider
*/
override fun isPhysical(): Boolean = true
}
/**
* Throw exception on an attempt to load a file tree
*
* @see com.intellij.psi.impl.source.PsiFileImpl.loadTreeElement
*/
updatedProvider.manager.setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, testRootDisposable)
val fileWithStub = object : KtFile(updatedProvider, false) {
// We have to override this method as well as the base implementation will skip
override fun getStub(): KotlinFileStub? = stubTree?.root as? KotlinFileStub
}
/**
* We have to replace the previous file to get the right stub
*
* @see com.intellij.psi.impl.source.PsiFileImpl.getStubTree
*/
updatedProvider.forceCachedPsi(fileWithStub)
assertNotNull("Stub for the file must not be null", fileWithStub.stub)
return fileWithStub
}
override val alternativeTestPrefix: String? get() = "stub"
}
@@ -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.
*/
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.builder
import org.jetbrains.kotlin.fir.renderer.FirRenderer
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.util.trimTrailingWhitespacesAndRemoveRedundantEmptyLinesAtTheEnd
import java.io.File
abstract class AbstractRawFirBuilderLazyBodiesTestCase : AbstractRawFirBuilderTestCase() {
@@ -14,7 +15,26 @@ abstract class AbstractRawFirBuilderLazyBodiesTestCase : AbstractRawFirBuilderTe
val file = createKtFile(filePath)
val firFile = file.toFirFile(BodyBuildingMode.LAZY_BODIES)
val firFileDump = FirRenderer().renderElementAsString(firFile)
val expectedPath = expectedPath(filePath, ".lazyBodies.txt")
KotlinTestUtils.assertEqualsToFile(File(expectedPath), firFileDump)
val originalExpectedFile = File(expectedPath(filePath, ".lazyBodies.txt"))
val alternativeExpectedFile = expectedAlternativeFileIfExists(filePath)
KotlinTestUtils.assertEqualsToFile(alternativeExpectedFile ?: originalExpectedFile, firFileDump)
val alternativeFileContent = alternativeExpectedFile?.readText()?.trimTrailingWhitespacesAndRemoveRedundantEmptyLinesAtTheEnd()
?: return
val originalFileContent = originalExpectedFile.readText().trimTrailingWhitespacesAndRemoveRedundantEmptyLinesAtTheEnd()
if (alternativeFileContent == originalFileContent) {
error("'${alternativeExpectedFile.name}' has the same content as '${originalExpectedFile.name}'")
}
}
}
protected fun expectedAlternativeFileIfExists(filePath: String): File? {
val alternativeFilePath = alternativeTestPrefix?.let {
expectedPath(filePath, ".$it.lazyBodies.txt")
} ?: return null
return File(alternativeFilePath).takeIf(File::exists)
}
protected open val alternativeTestPrefix: String? get() = null
}
@@ -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.
*/
@@ -170,8 +170,7 @@ abstract class AbstractRawFirBuilderTestCase : KtParsingTestCase(
private fun FirDeclaration.shouldAddParentContext(): Boolean = symbol is FirFunctionWithoutNameSymbol || !isNonLocal
}
protected fun createKtFile(filePath: String): KtFile {
protected open fun createKtFile(filePath: String): KtFile {
myFileExt = FileUtilRt.getExtension(PathUtil.getFileName(filePath))
return (createFile(filePath, KtNodeTypes.KT_FILE) as KtFile).apply {
myFile = this
@@ -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.
*/
@@ -14,10 +14,11 @@ import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.defaultConstructor.AbstractDefaultArgumentsReflectionTest
import org.jetbrains.kotlin.codegen.flags.AbstractWriteFlagsTest
import org.jetbrains.kotlin.codegen.ir.*
import org.jetbrains.kotlin.fir.java.AbstractFirOldFrontendLightClassesTest
import org.jetbrains.kotlin.fir.builder.AbstractRawFirBuilderLazyBodiesTestCase
import org.jetbrains.kotlin.fir.builder.AbstractRawFirBuilderLazyBodiesByAstTest
import org.jetbrains.kotlin.fir.builder.AbstractRawFirBuilderLazyBodiesByStubTest
import org.jetbrains.kotlin.fir.builder.AbstractRawFirBuilderSourceElementMappingTestCase
import org.jetbrains.kotlin.fir.builder.AbstractRawFirBuilderTestCase
import org.jetbrains.kotlin.fir.java.AbstractFirOldFrontendLightClassesTest
import org.jetbrains.kotlin.fir.java.AbstractFirTypeEnhancementTest
import org.jetbrains.kotlin.fir.java.AbstractOwnFirTypeEnhancementTest
import org.jetbrains.kotlin.fir.lightTree.AbstractLightTree2FirConverterTestCase
@@ -396,7 +397,11 @@ fun generateJUnit3CompilerTests(args: Array<String>, mainClassName: String?) {
model("rawBuilder", testMethod = "doRawFirTest", pattern = TestGeneratorUtil.KT_OR_KTS)
}
testClass<AbstractRawFirBuilderLazyBodiesTestCase> {
testClass<AbstractRawFirBuilderLazyBodiesByAstTest> {
model("rawBuilder", testMethod = "doRawFirTest", pattern = TestGeneratorUtil.KT_OR_KTS)
}
testClass<AbstractRawFirBuilderLazyBodiesByStubTest> {
model("rawBuilder", testMethod = "doRawFirTest", pattern = TestGeneratorUtil.KT_OR_KTS)
}