[FIR-TEST] Move FIR ide tests to separate module

This commit is contained in:
Dmitriy Novozhilov
2020-03-11 10:33:45 +03:00
parent 78f910e321
commit 36ec0a2e2e
18 changed files with 84 additions and 84 deletions
+60
View File
@@ -0,0 +1,60 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
testCompileOnly(toolsJar())
testCompile(projectTests(":idea"))
testCompile(projectTests(":compiler:tests-common"))
testCompile(projectTests(":idea:idea-test-framework")) { isTransitive = false }
testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(commonDep("junit:junit"))
testCompileOnly(intellijDep())
testRuntime(intellijDep())
Platform[192].orHigher {
testCompileOnly(intellijPluginDep("java"))
testRuntime(intellijPluginDep("java"))
}
testRuntime(intellijRuntimeAnnotations())
testRuntime(project(":native:kotlin-native-utils")) { isTransitive = false }
testRuntime(commonDep("org.jetbrains", "markdown"))
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }
testRuntime(project(":kotlin-reflect"))
testRuntime(project(":kotlin-preloader"))
testCompile(project(":kotlin-sam-with-receiver-compiler-plugin")) { isTransitive = false }
testRuntime(project(":plugins:android-extensions-compiler"))
testRuntimeOnly(project(":kotlin-android-extensions-runtime")) // TODO: fix import (workaround for jps build)
testRuntime(project(":plugins:android-extensions-ide")) { isTransitive = false }
testRuntime(project(":allopen-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-allopen-compiler-plugin"))
testRuntime(project(":noarg-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-noarg-compiler-plugin"))
testRuntime(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-idea")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-compiler-impl"))
testRuntime(project(":sam-with-receiver-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(project(":kotlinx-serialization-ide-plugin")) { isTransitive = false }
testRuntime(project(":idea:idea-android")) { isTransitive = false }
testRuntime(project(":plugins:lint")) { isTransitive = false }
testRuntime(project(":plugins:uast-kotlin"))
testRuntime(project(":nj2k:nj2k-services")) { isTransitive = false }
}
sourceSets {
"main" { none() }
"test" { projectDefault() }
}
projectTest(parallel = true) {
dependsOn(":dist")
workingDir = rootDir
}
testsJar()
@@ -0,0 +1,51 @@
/*
* Copyright 2010-2020 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.checkers
import com.intellij.rt.execution.junit.FileComparisonFailure
import org.jetbrains.kotlin.idea.fir.FirResolution
import org.jetbrains.kotlin.idea.test.withCustomCompilerOptions
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import java.io.File
abstract class AbstractFirPsiCheckerTest : AbstractPsiCheckerTest() {
override fun setUp() {
super.setUp()
FirResolution.enabled = true
}
override fun doTest(filePath: String) {
myFixture.configureByFile(fileName())
checkHighlighting(checkWarnings = false, checkInfos = false, checkWeakWarnings = false)
}
override fun checkHighlighting(
checkWarnings: Boolean,
checkInfos: Boolean,
checkWeakWarnings: Boolean
): Long {
val file = file
return withCustomCompilerOptions(file.text, project, module) {
val doComparison = InTextDirectivesUtils.isDirectiveDefined(myFixture.file.text, "FIR_COMPARISON")
try {
myFixture.checkHighlighting(checkWarnings, checkInfos, checkWeakWarnings)
} catch (e: FileComparisonFailure) {
if (doComparison) {
// Even this is very partial check (only error compatibility, no warnings / infos)
throw FileComparisonFailure(e.message, e.expected, e.actual, File(e.filePath).absolutePath)
} else {
// Here we just check that we haven't crashed due to exception
0
}
}
}
}
override fun tearDown() {
FirResolution.enabled = false
super.tearDown()
}
}
@@ -0,0 +1,905 @@
/*
* Copyright 2010-2020 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.checkers;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
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.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@RunWith(JUnit3RunnerWithInners.class)
public class FirPsiCheckerTestGenerated extends AbstractFirPsiCheckerTest {
@TestMetadata("idea/testData/checker")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Checker extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("Abstract.kt")
public void testAbstract() throws Exception {
runTest("idea/testData/checker/Abstract.kt");
}
public void testAllFilesPresentInChecker() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker"), Pattern.compile("^(.+)\\.kt$"), null, false);
}
@TestMetadata("AnnotationOnFile.kt")
public void testAnnotationOnFile() throws Exception {
runTest("idea/testData/checker/AnnotationOnFile.kt");
}
@TestMetadata("AnonymousInitializers.kt")
public void testAnonymousInitializers() throws Exception {
runTest("idea/testData/checker/AnonymousInitializers.kt");
}
@TestMetadata("BinaryCallsOnNullableValues.kt")
public void testBinaryCallsOnNullableValues() throws Exception {
runTest("idea/testData/checker/BinaryCallsOnNullableValues.kt");
}
@TestMetadata("Bounds.kt")
public void testBounds() throws Exception {
runTest("idea/testData/checker/Bounds.kt");
}
@TestMetadata("Bounds2.kt")
public void testBounds2() throws Exception {
runTest("idea/testData/checker/Bounds2.kt");
}
@TestMetadata("BoundsWithSubstitutors.kt")
public void testBoundsWithSubstitutors() throws Exception {
runTest("idea/testData/checker/BoundsWithSubstitutors.kt");
}
@TestMetadata("BreakContinue.kt")
public void testBreakContinue() throws Exception {
runTest("idea/testData/checker/BreakContinue.kt");
}
@TestMetadata("Builders.kt")
public void testBuilders() throws Exception {
runTest("idea/testData/checker/Builders.kt");
}
@TestMetadata("Casts.kt")
public void testCasts() throws Exception {
runTest("idea/testData/checker/Casts.kt");
}
@TestMetadata("ClassObjectInEnum.kt")
public void testClassObjectInEnum() throws Exception {
runTest("idea/testData/checker/ClassObjectInEnum.kt");
}
@TestMetadata("ClassObjects.kt")
public void testClassObjects() throws Exception {
runTest("idea/testData/checker/ClassObjects.kt");
}
@TestMetadata("Constants.kt")
public void testConstants() throws Exception {
runTest("idea/testData/checker/Constants.kt");
}
@TestMetadata("Constructors.kt")
public void testConstructors() throws Exception {
runTest("idea/testData/checker/Constructors.kt");
}
@TestMetadata("CyclicHierarchy.kt")
public void testCyclicHierarchy() throws Exception {
runTest("idea/testData/checker/CyclicHierarchy.kt");
}
@TestMetadata("ExposedContainerType.kt")
public void testExposedContainerType() throws Exception {
runTest("idea/testData/checker/ExposedContainerType.kt");
}
@TestMetadata("ExposedInferredType.kt")
public void testExposedInferredType() throws Exception {
runTest("idea/testData/checker/ExposedInferredType.kt");
}
@TestMetadata("ExtensionFunctions.kt")
public void testExtensionFunctions() throws Exception {
runTest("idea/testData/checker/ExtensionFunctions.kt");
}
@TestMetadata("ForRangeConventions.kt")
public void testForRangeConventions() throws Exception {
runTest("idea/testData/checker/ForRangeConventions.kt");
}
@TestMetadata("FunctionOnlyOneTypeParametersList.kt")
public void testFunctionOnlyOneTypeParametersList() throws Exception {
runTest("idea/testData/checker/FunctionOnlyOneTypeParametersList.kt");
}
@TestMetadata("FunctionReturnTypes.kt")
public void testFunctionReturnTypes() throws Exception {
runTest("idea/testData/checker/FunctionReturnTypes.kt");
}
@TestMetadata("GenericArgumentConsistency.kt")
public void testGenericArgumentConsistency() throws Exception {
runTest("idea/testData/checker/GenericArgumentConsistency.kt");
}
@TestMetadata("IncDec.kt")
public void testIncDec() throws Exception {
runTest("idea/testData/checker/IncDec.kt");
}
@TestMetadata("IsExpressions.kt")
public void testIsExpressions() throws Exception {
runTest("idea/testData/checker/IsExpressions.kt");
}
@TestMetadata("JvmStaticUsagesRuntime.kt")
public void testJvmStaticUsagesRuntime() throws Exception {
runTest("idea/testData/checker/JvmStaticUsagesRuntime.kt");
}
@TestMetadata("kt32189returnTypeWithTypealiasSubtitution.kt")
public void testKt32189returnTypeWithTypealiasSubtitution() throws Exception {
runTest("idea/testData/checker/kt32189returnTypeWithTypealiasSubtitution.kt");
}
@TestMetadata("LocalObjects.kt")
public void testLocalObjects() throws Exception {
runTest("idea/testData/checker/LocalObjects.kt");
}
@TestMetadata("MainWithWarningOnUnusedParam.kt")
public void testMainWithWarningOnUnusedParam() throws Exception {
runTest("idea/testData/checker/MainWithWarningOnUnusedParam.kt");
}
@TestMetadata("MainWithoutWarningOnUnusedParam.kt")
public void testMainWithoutWarningOnUnusedParam() throws Exception {
runTest("idea/testData/checker/MainWithoutWarningOnUnusedParam.kt");
}
@TestMetadata("MultipleBounds.kt")
public void testMultipleBounds() throws Exception {
runTest("idea/testData/checker/MultipleBounds.kt");
}
@TestMetadata("MultipleModality.kt")
public void testMultipleModality() throws Exception {
runTest("idea/testData/checker/MultipleModality.kt");
}
@TestMetadata("NestedObjects.kt")
public void testNestedObjects() throws Exception {
runTest("idea/testData/checker/NestedObjects.kt");
}
@TestMetadata("NotFinishedGenericDeclaration.kt")
public void testNotFinishedGenericDeclaration() throws Exception {
runTest("idea/testData/checker/NotFinishedGenericDeclaration.kt");
}
@TestMetadata("NullAsAnnotationArgument.kt")
public void testNullAsAnnotationArgument() throws Exception {
runTest("idea/testData/checker/NullAsAnnotationArgument.kt");
}
@TestMetadata("Nullability.kt")
public void testNullability() throws Exception {
runTest("idea/testData/checker/Nullability.kt");
}
@TestMetadata("ObjectLiteralInDelegate.kt")
public void testObjectLiteralInDelegate() throws Exception {
runTest("idea/testData/checker/ObjectLiteralInDelegate.kt");
}
@TestMetadata("Objects.kt")
public void testObjects() throws Exception {
runTest("idea/testData/checker/Objects.kt");
}
@TestMetadata("Override.kt")
public void testOverride() throws Exception {
runTest("idea/testData/checker/Override.kt");
}
@TestMetadata("OverridesAndGenerics.kt")
public void testOverridesAndGenerics() throws Exception {
runTest("idea/testData/checker/OverridesAndGenerics.kt");
}
@TestMetadata("PackageQualified.kt")
public void testPackageQualified() throws Exception {
runTest("idea/testData/checker/PackageQualified.kt");
}
@TestMetadata("PrimaryConstructors.kt")
public void testPrimaryConstructors() throws Exception {
runTest("idea/testData/checker/PrimaryConstructors.kt");
}
@TestMetadata("ProjectionsInSupertypes.kt")
public void testProjectionsInSupertypes() throws Exception {
runTest("idea/testData/checker/ProjectionsInSupertypes.kt");
}
@TestMetadata("Properties.kt")
public void testProperties() throws Exception {
runTest("idea/testData/checker/Properties.kt");
}
@TestMetadata("QualifiedExpressions.kt")
public void testQualifiedExpressions() throws Exception {
runTest("idea/testData/checker/QualifiedExpressions.kt");
}
@TestMetadata("QualifiedThis.kt")
public void testQualifiedThis() throws Exception {
runTest("idea/testData/checker/QualifiedThis.kt");
}
@TestMetadata("QualifiedThisInClosures.kt")
public void testQualifiedThisInClosures() throws Exception {
runTest("idea/testData/checker/QualifiedThisInClosures.kt");
}
@TestMetadata("Redeclaration.kt")
public void testRedeclaration() throws Exception {
runTest("idea/testData/checker/Redeclaration.kt");
}
@TestMetadata("Redeclarations.kt")
public void testRedeclarations() throws Exception {
runTest("idea/testData/checker/Redeclarations.kt");
}
@TestMetadata("ResolveToJava.kt")
public void testResolveToJava() throws Exception {
runTest("idea/testData/checker/ResolveToJava.kt");
}
@TestMetadata("ResolveTypeInAnnotationArgumentRuntime.kt")
public void testResolveTypeInAnnotationArgumentRuntime() throws Exception {
runTest("idea/testData/checker/ResolveTypeInAnnotationArgumentRuntime.kt");
}
@TestMetadata("ReturnTypeMismatchOnOverride.kt")
public void testReturnTypeMismatchOnOverride() throws Exception {
runTest("idea/testData/checker/ReturnTypeMismatchOnOverride.kt");
}
@TestMetadata("SafeInvoke.kt")
public void testSafeInvoke() throws Exception {
runTest("idea/testData/checker/SafeInvoke.kt");
}
@TestMetadata("Shadowing.kt")
public void testShadowing() throws Exception {
runTest("idea/testData/checker/Shadowing.kt");
}
@TestMetadata("StringTemplates.kt")
public void testStringTemplates() throws Exception {
runTest("idea/testData/checker/StringTemplates.kt");
}
@TestMetadata("SupertypeListChecks.kt")
public void testSupertypeListChecks() throws Exception {
runTest("idea/testData/checker/SupertypeListChecks.kt");
}
@TestMetadata("TraitSupertypeList.kt")
public void testTraitSupertypeList() throws Exception {
runTest("idea/testData/checker/TraitSupertypeList.kt");
}
@TestMetadata("trivialHierarchyLoop.kt")
public void testTrivialHierarchyLoop() throws Exception {
runTest("idea/testData/checker/trivialHierarchyLoop.kt");
}
@TestMetadata("TypeArgumentsNotAllowed.kt")
public void testTypeArgumentsNotAllowed() throws Exception {
runTest("idea/testData/checker/TypeArgumentsNotAllowed.kt");
}
@TestMetadata("TypeParameterBounds.kt")
public void testTypeParameterBounds() throws Exception {
runTest("idea/testData/checker/TypeParameterBounds.kt");
}
@TestMetadata("UnreachableCode.kt")
public void testUnreachableCode() throws Exception {
runTest("idea/testData/checker/UnreachableCode.kt");
}
@TestMetadata("Unresolved.kt")
public void testUnresolved() throws Exception {
runTest("idea/testData/checker/Unresolved.kt");
}
@TestMetadata("Unused.kt")
public void testUnused() throws Exception {
runTest("idea/testData/checker/Unused.kt");
}
@TestMetadata("Variance.kt")
public void testVariance() throws Exception {
runTest("idea/testData/checker/Variance.kt");
}
@TestMetadata("When.kt")
public void testWhen() throws Exception {
runTest("idea/testData/checker/When.kt");
}
@TestMetadata("WhenInEnumInExtensionProperty.kt")
public void testWhenInEnumInExtensionProperty() throws Exception {
runTest("idea/testData/checker/WhenInEnumInExtensionProperty.kt");
}
@TestMetadata("WhenNonExhaustive.kt")
public void testWhenNonExhaustive() throws Exception {
runTest("idea/testData/checker/WhenNonExhaustive.kt");
}
}
@TestMetadata("idea/testData/checker/regression")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Regression extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInRegression() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/regression"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("AmbiguityOnLazyTypeComputation.kt")
public void testAmbiguityOnLazyTypeComputation() throws Exception {
runTest("idea/testData/checker/regression/AmbiguityOnLazyTypeComputation.kt");
}
@TestMetadata("AnnotationOnNamedParameterOfFunctionType.kt")
public void testAnnotationOnNamedParameterOfFunctionType() throws Exception {
runTest("idea/testData/checker/regression/AnnotationOnNamedParameterOfFunctionType.kt");
}
@TestMetadata("AnnotationOnParameterOfFunctionType.kt")
public void testAnnotationOnParameterOfFunctionType() throws Exception {
runTest("idea/testData/checker/regression/AnnotationOnParameterOfFunctionType.kt");
}
@TestMetadata("AssignmentsUnderOperators.kt")
public void testAssignmentsUnderOperators() throws Exception {
runTest("idea/testData/checker/regression/AssignmentsUnderOperators.kt");
}
@TestMetadata("BadParseForClass.kt")
public void testBadParseForClass() throws Exception {
runTest("idea/testData/checker/regression/BadParseForClass.kt");
}
@TestMetadata("callVariableAsFunctionWithAnonymousObjectArg.kt")
public void testCallVariableAsFunctionWithAnonymousObjectArg() throws Exception {
runTest("idea/testData/checker/regression/callVariableAsFunctionWithAnonymousObjectArg.kt");
}
@TestMetadata("callVariableAsFunctionWithLambdaArg.kt")
public void testCallVariableAsFunctionWithLambdaArg() throws Exception {
runTest("idea/testData/checker/regression/callVariableAsFunctionWithLambdaArg.kt");
}
@TestMetadata("ClassDeclarationAfterDot.kt")
public void testClassDeclarationAfterDot() throws Exception {
runTest("idea/testData/checker/regression/ClassDeclarationAfterDot.kt");
}
@TestMetadata("ClassDeclarationAfterDot2.kt")
public void testClassDeclarationAfterDot2() throws Exception {
runTest("idea/testData/checker/regression/ClassDeclarationAfterDot2.kt");
}
@TestMetadata("ClassDeclarationAsExpression.kt")
public void testClassDeclarationAsExpression() throws Exception {
runTest("idea/testData/checker/regression/ClassDeclarationAsExpression.kt");
}
@TestMetadata("ClassDeclarationAsExpression2.kt")
public void testClassDeclarationAsExpression2() throws Exception {
runTest("idea/testData/checker/regression/ClassDeclarationAsExpression2.kt");
}
@TestMetadata("ClassDeclarationAsExpression3.kt")
public void testClassDeclarationAsExpression3() throws Exception {
runTest("idea/testData/checker/regression/ClassDeclarationAsExpression3.kt");
}
@TestMetadata("CoercionToUnit.kt")
public void testCoercionToUnit() throws Exception {
runTest("idea/testData/checker/regression/CoercionToUnit.kt");
}
@TestMetadata("createInnerInstance.kt")
public void testCreateInnerInstance() throws Exception {
runTest("idea/testData/checker/regression/createInnerInstance.kt");
}
@TestMetadata("DescructuringDeclarationInForLoop.kt")
public void testDescructuringDeclarationInForLoop() throws Exception {
runTest("idea/testData/checker/regression/DescructuringDeclarationInForLoop.kt");
}
@TestMetadata("DestructuringDeclarationInLambda.kt")
public void testDestructuringDeclarationInLambda() throws Exception {
runTest("idea/testData/checker/regression/DestructuringDeclarationInLambda.kt");
}
@TestMetadata("DollarsInName.kt")
public void testDollarsInName() throws Exception {
runTest("idea/testData/checker/regression/DollarsInName.kt");
}
@TestMetadata("DoubleDefine.kt")
public void testDoubleDefine() throws Exception {
runTest("idea/testData/checker/regression/DoubleDefine.kt");
}
@TestMetadata("extensionMemberInClassObject.kt")
public void testExtensionMemberInClassObject() throws Exception {
runTest("idea/testData/checker/regression/extensionMemberInClassObject.kt");
}
@TestMetadata("FunDeclarationAfterDot.kt")
public void testFunDeclarationAfterDot() throws Exception {
runTest("idea/testData/checker/regression/FunDeclarationAfterDot.kt");
}
@TestMetadata("FunctionLiteralInsideAnnotation.kt")
public void testFunctionLiteralInsideAnnotation() throws Exception {
runTest("idea/testData/checker/regression/FunctionLiteralInsideAnnotation.kt");
}
@TestMetadata("FunctionTypes.kt")
public void testFunctionTypes() throws Exception {
runTest("idea/testData/checker/regression/FunctionTypes.kt");
}
@TestMetadata("IncompleteClassDelegation.kt")
public void testIncompleteClassDelegation() throws Exception {
runTest("idea/testData/checker/regression/IncompleteClassDelegation.kt");
}
@TestMetadata("InitializerInInterface.kt")
public void testInitializerInInterface() throws Exception {
runTest("idea/testData/checker/regression/InitializerInInterface.kt");
}
@TestMetadata("InterfaceDeclarationAsExpression.kt")
public void testInterfaceDeclarationAsExpression() throws Exception {
runTest("idea/testData/checker/regression/InterfaceDeclarationAsExpression.kt");
}
@TestMetadata("javaStyleClassLiteralInAnnotationArguments.kt")
public void testJavaStyleClassLiteralInAnnotationArguments() throws Exception {
runTest("idea/testData/checker/regression/javaStyleClassLiteralInAnnotationArguments.kt");
}
@TestMetadata("Jet11.kt")
public void testJet11() throws Exception {
runTest("idea/testData/checker/regression/Jet11.kt");
}
@TestMetadata("Jet121.kt")
public void testJet121() throws Exception {
runTest("idea/testData/checker/regression/Jet121.kt");
}
@TestMetadata("Jet124.kt")
public void testJet124() throws Exception {
runTest("idea/testData/checker/regression/Jet124.kt");
}
@TestMetadata("Jet169.kt")
public void testJet169() throws Exception {
runTest("idea/testData/checker/regression/Jet169.kt");
}
@TestMetadata("Jet183.kt")
public void testJet183() throws Exception {
runTest("idea/testData/checker/regression/Jet183.kt");
}
@TestMetadata("Jet183-1.kt")
public void testJet183_1() throws Exception {
runTest("idea/testData/checker/regression/Jet183-1.kt");
}
@TestMetadata("Jet53.kt")
public void testJet53() throws Exception {
runTest("idea/testData/checker/regression/Jet53.kt");
}
@TestMetadata("Jet67.kt")
public void testJet67() throws Exception {
runTest("idea/testData/checker/regression/Jet67.kt");
}
@TestMetadata("Jet68.kt")
public void testJet68() throws Exception {
runTest("idea/testData/checker/regression/Jet68.kt");
}
@TestMetadata("Jet69.kt")
public void testJet69() throws Exception {
runTest("idea/testData/checker/regression/Jet69.kt");
}
@TestMetadata("Jet72.kt")
public void testJet72() throws Exception {
runTest("idea/testData/checker/regression/Jet72.kt");
}
@TestMetadata("kt251.kt")
public void testKt251() throws Exception {
runTest("idea/testData/checker/regression/kt251.kt");
}
@TestMetadata("kt303.kt")
public void testKt303() throws Exception {
runTest("idea/testData/checker/regression/kt303.kt");
}
@TestMetadata("kt9887.kt")
public void testKt9887() throws Exception {
runTest("idea/testData/checker/regression/kt9887.kt");
}
@TestMetadata("objectLiteralInSupertypeList.kt")
public void testObjectLiteralInSupertypeList() throws Exception {
runTest("idea/testData/checker/regression/objectLiteralInSupertypeList.kt");
}
@TestMetadata("OverrideResolution.kt")
public void testOverrideResolution() throws Exception {
runTest("idea/testData/checker/regression/OverrideResolution.kt");
}
@TestMetadata("PropertyDeclarationAsExpression.kt")
public void testPropertyDeclarationAsExpression() throws Exception {
runTest("idea/testData/checker/regression/PropertyDeclarationAsExpression.kt");
}
@TestMetadata("ScopeForSecondaryConstructors.kt")
public void testScopeForSecondaryConstructors() throws Exception {
runTest("idea/testData/checker/regression/ScopeForSecondaryConstructors.kt");
}
@TestMetadata("SpecififcityByReceiver.kt")
public void testSpecififcityByReceiver() throws Exception {
runTest("idea/testData/checker/regression/SpecififcityByReceiver.kt");
}
@TestMetadata("WrongTraceInCallResolver.kt")
public void testWrongTraceInCallResolver() throws Exception {
runTest("idea/testData/checker/regression/WrongTraceInCallResolver.kt");
}
}
@TestMetadata("idea/testData/checker/recovery")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Recovery extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInRecovery() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/recovery"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("namelessMembers.kt")
public void testNamelessMembers() throws Exception {
runTest("idea/testData/checker/recovery/namelessMembers.kt");
}
@TestMetadata("namelessToplevelDeclarations.kt")
public void testNamelessToplevelDeclarations() throws Exception {
runTest("idea/testData/checker/recovery/namelessToplevelDeclarations.kt");
}
@TestMetadata("returnInFileAnnotation.kt")
public void testReturnInFileAnnotation() throws Exception {
runTest("idea/testData/checker/recovery/returnInFileAnnotation.kt");
}
}
@TestMetadata("idea/testData/checker/rendering")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Rendering extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInRendering() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/rendering"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("TypeInferenceError.kt")
public void testTypeInferenceError() throws Exception {
runTest("idea/testData/checker/rendering/TypeInferenceError.kt");
}
}
@TestMetadata("idea/testData/checker/duplicateJvmSignature")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DuplicateJvmSignature extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInDuplicateJvmSignature() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/duplicateJvmSignature"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("idea/testData/checker/duplicateJvmSignature/fields")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Fields extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInFields() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/duplicateJvmSignature/fields"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("classObjectCopiedFieldObject.kt")
public void testClassObjectCopiedFieldObject() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/fields/classObjectCopiedFieldObject.kt");
}
}
@TestMetadata("idea/testData/checker/duplicateJvmSignature/functionAndProperty")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class FunctionAndProperty extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInFunctionAndProperty() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/duplicateJvmSignature/functionAndProperty"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("ambiguous.kt")
public void testAmbiguous() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/ambiguous.kt");
}
@TestMetadata("class.kt")
public void testClass() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/class.kt");
}
@TestMetadata("classObject.kt")
public void testClassObject() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/classObject.kt");
}
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/localClass.kt");
}
@TestMetadata("nestedClass.kt")
public void testNestedClass() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/nestedClass.kt");
}
@TestMetadata("object.kt")
public void testObject() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/object.kt");
}
@TestMetadata("objectExpression.kt")
public void testObjectExpression() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/objectExpression.kt");
}
@TestMetadata("topLevel.kt")
public void testTopLevel() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/topLevel.kt");
}
@TestMetadata("topLevelMultifileRuntime.kt")
public void testTopLevelMultifileRuntime() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/topLevelMultifileRuntime.kt");
}
@TestMetadata("trait.kt")
public void testTrait() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/functionAndProperty/trait.kt");
}
}
@TestMetadata("idea/testData/checker/duplicateJvmSignature/traitImpl")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TraitImpl extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTraitImpl() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/duplicateJvmSignature/traitImpl"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("twoTraits.kt")
public void testTwoTraits() throws Exception {
runTest("idea/testData/checker/duplicateJvmSignature/traitImpl/twoTraits.kt");
}
}
}
@TestMetadata("idea/testData/checker/infos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Infos extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInInfos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/infos"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("CapturedConstructorParameter.kt")
public void testCapturedConstructorParameter() throws Exception {
runTest("idea/testData/checker/infos/CapturedConstructorParameter.kt");
}
@TestMetadata("CapturedInInlinedClosure.kt")
public void testCapturedInInlinedClosure() throws Exception {
runTest("idea/testData/checker/infos/CapturedInInlinedClosure.kt");
}
@TestMetadata("multipleResolvedCalls.kt")
public void testMultipleResolvedCalls() throws Exception {
runTest("idea/testData/checker/infos/multipleResolvedCalls.kt");
}
@TestMetadata("PropertiesWithBackingFields.kt")
public void testPropertiesWithBackingFields() throws Exception {
runTest("idea/testData/checker/infos/PropertiesWithBackingFields.kt");
}
@TestMetadata("smartCastOnElvis.kt")
public void testSmartCastOnElvis() throws Exception {
runTest("idea/testData/checker/infos/smartCastOnElvis.kt");
}
@TestMetadata("SmartCastOnIf.kt")
public void testSmartCastOnIf() throws Exception {
runTest("idea/testData/checker/infos/SmartCastOnIf.kt");
}
@TestMetadata("SmartCastOnWhen.kt")
public void testSmartCastOnWhen() throws Exception {
runTest("idea/testData/checker/infos/SmartCastOnWhen.kt");
}
@TestMetadata("SmartCastTarget.kt")
public void testSmartCastTarget() throws Exception {
runTest("idea/testData/checker/infos/SmartCastTarget.kt");
}
@TestMetadata("SmartCastToEnum.kt")
public void testSmartCastToEnum() throws Exception {
runTest("idea/testData/checker/infos/SmartCastToEnum.kt");
}
@TestMetadata("SmartCasts.kt")
public void testSmartCasts() throws Exception {
runTest("idea/testData/checker/infos/SmartCasts.kt");
}
@TestMetadata("SmartCastsWithSafeAccess.kt")
public void testSmartCastsWithSafeAccess() throws Exception {
runTest("idea/testData/checker/infos/SmartCastsWithSafeAccess.kt");
}
@TestMetadata("threeImplicitReceivers.kt")
public void testThreeImplicitReceivers() throws Exception {
runTest("idea/testData/checker/infos/threeImplicitReceivers.kt");
}
@TestMetadata("twoImplicitReceivers.kt")
public void testTwoImplicitReceivers() throws Exception {
runTest("idea/testData/checker/infos/twoImplicitReceivers.kt");
}
@TestMetadata("Typos.kt")
public void testTypos() throws Exception {
runTest("idea/testData/checker/infos/Typos.kt");
}
@TestMetadata("TyposInOverrideParams.kt")
public void testTyposInOverrideParams() throws Exception {
runTest("idea/testData/checker/infos/TyposInOverrideParams.kt");
}
@TestMetadata("WrapIntoRef.kt")
public void testWrapIntoRef() throws Exception {
runTest("idea/testData/checker/infos/WrapIntoRef.kt");
}
}
@TestMetadata("idea/testData/checker/diagnosticsMessage")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DiagnosticsMessage extends AbstractFirPsiCheckerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInDiagnosticsMessage() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/checker/diagnosticsMessage"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("fullPackageFQNameOnVisiblityError.kt")
public void testFullPackageFQNameOnVisiblityError() throws Exception {
runTest("idea/testData/checker/diagnosticsMessage/fullPackageFQNameOnVisiblityError.kt");
}
@TestMetadata("incompleteTypeArgumentList.kt")
public void testIncompleteTypeArgumentList() throws Exception {
runTest("idea/testData/checker/diagnosticsMessage/incompleteTypeArgumentList.kt");
}
@TestMetadata("instantiationOfInnerClassInQualifiedForm.kt")
public void testInstantiationOfInnerClassInQualifiedForm() throws Exception {
runTest("idea/testData/checker/diagnosticsMessage/instantiationOfInnerClassInQualifiedForm.kt");
}
@TestMetadata("lateinitOfATypeWithNullableUpperBound.kt")
public void testLateinitOfATypeWithNullableUpperBound() throws Exception {
runTest("idea/testData/checker/diagnosticsMessage/lateinitOfATypeWithNullableUpperBound.kt");
}
@TestMetadata("nArgumentsExpectedMessage.kt")
public void testNArgumentsExpectedMessage() throws Exception {
runTest("idea/testData/checker/diagnosticsMessage/nArgumentsExpectedMessage.kt");
}
@TestMetadata("noSubstitutedTypeParameter.kt")
public void testNoSubstitutedTypeParameter() throws Exception {
runTest("idea/testData/checker/diagnosticsMessage/noSubstitutedTypeParameter.kt");
}
@TestMetadata("operatorCallDiagnosticsOnInOperator.kt")
public void testOperatorCallDiagnosticsOnInOperator() throws Exception {
runTest("idea/testData/checker/diagnosticsMessage/operatorCallDiagnosticsOnInOperator.kt");
}
}
}
@@ -0,0 +1,109 @@
/*
* Copyright 2010-2020 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.idea.fir
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.search.FileTypeIndex
import com.intellij.testFramework.LightProjectDescriptor
import junit.framework.TestCase
import org.jetbrains.kotlin.fir.declarations.FirResolvedImport
import org.jetbrains.kotlin.fir.render
import org.jetbrains.kotlin.fir.resolve.FirProvider
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo
import org.jetbrains.kotlin.idea.caches.project.productionSourceInfo
import org.jetbrains.kotlin.idea.jsonUtils.getString
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.KotlinTestUtils
import java.io.File
abstract class AbstractFirLazyResolveTest : KotlinLightCodeInsightFixtureTestCase() {
override fun getProjectDescriptor(): LightProjectDescriptor {
if (KotlinTestUtils.isAllFilesPresentTest(getTestName(false))) return super.getProjectDescriptor()
val testFile = File(testDataPath, fileName())
val config = JsonParser().parse(FileUtil.loadFile(testFile, true)) as JsonObject
val withRuntime = config["withRuntime"]?.asBoolean ?: false
return if (withRuntime)
KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
else
KotlinLightProjectDescriptor.INSTANCE
}
fun doTest(path: String) {
val testFile = File(path)
val config = JsonParser().parse(FileUtil.loadFile(testFile, true)) as JsonObject
val mainFilePath = config.getString("mainFile")
val mainFile = File(testFile.parent, mainFilePath)
val mainFileText = FileUtil.loadFile(mainFile, true)
TestCase.assertTrue("\"<caret>\" is missing in file \"$mainFilePath\"", mainFileText.contains("<caret>"))
val projectDir = path.removePrefix(testDataPath).substringBeforeLast('/')
myFixture.copyDirectoryToProject(projectDir, "")
PsiDocumentManager.getInstance(myFixture.project).commitAllDocuments()
myFixture.configureFromTempProjectFile(mainFilePath)
val referenceToResolve = myFixture.getReferenceAtCaretPositionWithAssertion(mainFilePath)
val elementToResolve = referenceToResolve.element
val expressionToResolve = when {
elementToResolve.parent is KtCallExpression -> elementToResolve.parent
else -> elementToResolve
} as KtExpression
val resolveState = expressionToResolve.firResolveState()
val resultsDump = when (val firElement = expressionToResolve.getOrBuildFir(resolveState)) {
is FirResolvedImport -> buildString {
append("import ")
append(firElement.packageFqName)
val className = firElement.relativeClassName
if (className != null) {
append("/")
append(className)
}
val name = firElement.importedName
if (name != null) {
append(".")
append(name)
}
}
else -> firElement.render()
}
KotlinTestUtils.assertEqualsToFile(File(testFile.parent, "results.txt"), resultsDump)
fun expectedTxtPath(virtualFile: VirtualFile): String {
val virtualPath = virtualFile.path.substringAfter("/src/")
var result: String? = null
val root = File(path).parentFile
for (file in root.walkTopDown()) {
if (!file.isDirectory && virtualPath in file.absolutePath.replace("\\", "/")) {
result = file.absolutePath.replace(".kt", ".txt")
}
}
return result!!
}
val moduleInfo = project.allModules().single().productionSourceInfo() as IdeaModuleInfo
val contentScope = moduleInfo.contentScope()
val files = FileTypeIndex.getFiles(KotlinFileType.INSTANCE, contentScope)
for (file in files) {
val psiFile = psiManager.findFile(file) as KtFile
val session = resolveState.getSession(psiFile)
val firProvider = FirProvider.getInstance(session) as FirIdeProvider
val firFile = firProvider.getFile(psiFile) ?: continue
KotlinTestUtils.assertEqualsToFile(File(expectedTxtPath(file)), firFile.render())
}
}
}
@@ -0,0 +1,195 @@
/*
* Copyright 2010-2019 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.idea.fir
import com.intellij.openapi.module.Module
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiManager
import com.intellij.psi.search.FileTypeIndex
import org.jetbrains.kotlin.fir.FirRenderer
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
import org.jetbrains.kotlin.fir.declarations.FirFile
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
import org.jetbrains.kotlin.fir.dependenciesWithoutSelf
import org.jetbrains.kotlin.fir.java.FirJavaModuleBasedSession
import org.jetbrains.kotlin.fir.java.FirLibrarySession
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
import org.jetbrains.kotlin.fir.java.JavaSymbolProvider
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
import org.jetbrains.kotlin.fir.java.declarations.FirJavaMethod
import org.jetbrains.kotlin.fir.java.scopes.JavaClassEnhancementScope
import org.jetbrains.kotlin.fir.psi
import org.jetbrains.kotlin.fir.resolve.ScopeSession
import org.jetbrains.kotlin.fir.resolve.buildUseSiteMemberScope
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
import org.jetbrains.kotlin.fir.resolve.impl.FirCompositeSymbolProvider
import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer
import org.jetbrains.kotlin.fir.scopes.impl.FirCompositeScope
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo
import org.jetbrains.kotlin.idea.caches.project.isLibraryClasses
import org.jetbrains.kotlin.idea.caches.project.productionSourceInfo
import org.jetbrains.kotlin.idea.caches.resolve.IDEPackagePartProvider
import org.jetbrains.kotlin.idea.multiplatform.setupMppProjectFromDirStructure
import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.utils.addToStdlib.cast
import java.io.File
abstract class AbstractFirMultiModuleResolveTest : AbstractMultiModuleTest() {
override fun getTestDataPath(): String {
return File(PluginTestCaseBase.getTestDataPathBase(), "/fir/multiModule").path + File.separator
}
fun doTest(dirPath: String) {
setupMppProjectFromDirStructure(File(dirPath))
val useFullJdk = "full" in dirPath
val jdkKind = if (useFullJdk) TestJdkKind.FULL_JDK else TestJdkKind.MOCK_JDK
for (module in project.allModules().drop(1)) {
ConfigLibraryUtil.configureSdk(
module,
PluginTestCaseBase.addJdk(testRootDisposable) { PluginTestCaseBase.jdk(jdkKind) }
)
}
doFirResolveTest(dirPath)
}
private fun createSession(module: Module, provider: FirProjectSessionProvider): FirJavaModuleBasedSession {
val moduleInfo = module.productionSourceInfo()!!
return FirJavaModuleBasedSession(moduleInfo, provider, moduleInfo.contentScope())
}
private fun createLibrarySession(moduleInfo: IdeaModuleInfo, provider: FirProjectSessionProvider): FirLibrarySession {
val contentScope = moduleInfo.contentScope()
return FirLibrarySession.create(moduleInfo, provider, contentScope, project, IDEPackagePartProvider(contentScope))
}
private fun doFirResolveTest(dirPath: String) {
val firFilesPerSession = mutableMapOf<FirJavaModuleBasedSession, List<FirFile>>()
val totalTransformerPerSession = mutableMapOf<FirJavaModuleBasedSession, FirTotalResolveTransformer>()
val sessions = mutableListOf<FirJavaModuleBasedSession>()
val provider = FirProjectSessionProvider(project)
for (module in project.allModules().drop(1)) {
val session = createSession(module, provider)
sessions += session
val firProvider = (session.firProvider as FirProviderImpl)
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, stubMode = false)
val psiManager = PsiManager.getInstance(project)
val ideaModuleInfo = session.moduleInfo.cast<IdeaModuleInfo>()
ideaModuleInfo.dependenciesWithoutSelf().forEach {
if (it is IdeaModuleInfo && it.isLibraryClasses()) {
createLibrarySession(it, provider)
}
}
val contentScope = ideaModuleInfo.contentScope()
val files = FileTypeIndex.getFiles(KotlinFileType.INSTANCE, contentScope)
println("Got vfiles: ${files.size}")
val firFiles = mutableListOf<FirFile>()
files.forEach {
val file = psiManager.findFile(it) as? KtFile ?: return@forEach
val firFile = builder.buildFirFile(file)
firProvider.recordFile(firFile)
firFiles += firFile
}
firFilesPerSession[session] = firFiles
totalTransformerPerSession[session] = FirTotalResolveTransformer()
}
println("Raw fir up, files: ${firFilesPerSession.values.flatten().size}")
fun expectedTxtPath(virtualFile: VirtualFile): String {
val virtualPath = virtualFile.path
var result: String? = null
val root = File(dirPath)
for (file in root.walkTopDown()) {
if (!file.isDirectory && file.name in virtualPath) {
result = file.absolutePath.replace(".kt", ".txt")
}
}
return result!!
}
// Start from 1 to miss raw FIR building
for (phaseIndex in 1 until FirResolvePhase.values().size) {
for (session in sessions) {
val firFiles = firFilesPerSession[session]!!
val transformer = totalTransformerPerSession[session]!!
for (file in firFiles) {
transformer.transformers[phaseIndex - 1].visitFile(file, null)
}
}
}
for (file in firFilesPerSession.values.flatten()) {
val firFileDump = StringBuilder().also { file.accept(FirRenderer(it), null) }.toString()
val expectedPath = expectedTxtPath((file.psi as PsiFile).virtualFile)
KotlinTestUtils.assertEqualsToFile(File(expectedPath), firFileDump)
}
val processedJavaClasses = mutableSetOf<FirJavaClass>()
val javaFirDump = StringBuilder().also { builder ->
val renderer = FirRenderer(builder)
for (session in sessions) {
val symbolProvider = session.firSymbolProvider as FirCompositeSymbolProvider
val javaProvider = symbolProvider.providers.filterIsInstance<JavaSymbolProvider>().first()
for (javaClass in javaProvider.getJavaTopLevelClasses().sortedBy { it.name }) {
if (javaClass !is FirJavaClass || javaClass in processedJavaClasses) continue
val enhancementScope = javaClass.buildUseSiteMemberScope(session, ScopeSession()).let {
when (it) {
is FirCompositeScope -> it.scopes.filterIsInstance<JavaClassEnhancementScope>().first()
is JavaClassEnhancementScope -> it
else -> null
}
}
if (enhancementScope == null) {
javaClass.accept(renderer, null)
} else {
renderer.visitMemberDeclaration(javaClass)
renderer.renderSupertypes(javaClass)
renderer.renderInBraces {
val renderedDeclarations = mutableListOf<FirDeclaration>()
for (declaration in javaClass.declarations) {
if (declaration in renderedDeclarations) continue
if (declaration !is FirJavaMethod) {
declaration.accept(renderer, null)
renderer.newLine()
renderedDeclarations += declaration
} else {
enhancementScope.processFunctionsByName(declaration.name) { symbol ->
val enhanced = symbol.fir
if (enhanced !in renderedDeclarations) {
enhanced.accept(renderer, null)
renderer.newLine()
renderedDeclarations += enhanced
}
}
}
}
}
}
processedJavaClasses += javaClass
}
}
}.toString()
if (javaFirDump.isNotEmpty()) {
KotlinTestUtils.assertEqualsToFile(File("$dirPath/extraDump.java.txt"), javaFirDump)
}
}
}
@@ -0,0 +1,70 @@
/*
* Copyright 2010-2020 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.idea.fir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
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.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/fir/lazyResolve")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class FirLazyResolveTestGenerated extends AbstractFirLazyResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLazyResolve() throws Exception {
KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClassWithExcluded(this.getClass(), new File("idea/testData/fir/lazyResolve"), Pattern.compile("^(.+)\\.test$"), null);
}
@TestMetadata("elvis/elvis.test")
public void testElvis_Elvis() throws Exception {
runTest("idea/testData/fir/lazyResolve/elvis/elvis.test");
}
@TestMetadata("import/import.test")
public void testImport_Import() throws Exception {
runTest("idea/testData/fir/lazyResolve/import/import.test");
}
@TestMetadata("inInit/inInit.test")
public void testInInit_InInit() throws Exception {
runTest("idea/testData/fir/lazyResolve/inInit/inInit.test");
}
@TestMetadata("inLocal/inLocal.test")
public void testInLocal_InLocal() throws Exception {
runTest("idea/testData/fir/lazyResolve/inLocal/inLocal.test");
}
@TestMetadata("inSecondary/inSecondary.test")
public void testInSecondary_InSecondary() throws Exception {
runTest("idea/testData/fir/lazyResolve/inSecondary/inSecondary.test");
}
@TestMetadata("secondary/secondary.test")
public void testSecondary_Secondary() throws Exception {
runTest("idea/testData/fir/lazyResolve/secondary/secondary.test");
}
@TestMetadata("simple/simple.test")
public void testSimple_Simple() throws Exception {
runTest("idea/testData/fir/lazyResolve/simple/simple.test");
}
@TestMetadata("simpleProperty/simpleProperty.test")
public void testSimpleProperty_SimpleProperty() throws Exception {
runTest("idea/testData/fir/lazyResolve/simpleProperty/simpleProperty.test");
}
}
@@ -0,0 +1,130 @@
/*
* Copyright 2010-2020 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.idea.fir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
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.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/fir/multiModule")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class FirMultiModuleResolveTestGenerated extends AbstractFirMultiModuleResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInMultiModule() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/fir/multiModule"), Pattern.compile("^([^\\.]+)$"), null, false);
}
@TestMetadata("basic")
public void testBasic() throws Exception {
runTest("idea/testData/fir/multiModule/basic/");
}
@TestMetadata("basicWithAnnotatedJava")
public void testBasicWithAnnotatedJava() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithAnnotatedJava/");
}
@TestMetadata("basicWithAnnotatedOverriddenJava")
public void testBasicWithAnnotatedOverriddenJava() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithAnnotatedOverriddenJava/");
}
@TestMetadata("basicWithJava")
public void testBasicWithJava() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithJava/");
}
@TestMetadata("basicWithJavaFakeOverride")
public void testBasicWithJavaFakeOverride() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithJavaFakeOverride/");
}
@TestMetadata("basicWithPrimitiveJava")
public void testBasicWithPrimitiveJava() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithPrimitiveJava/");
}
@TestMetadata("fieldAccessFromDerived")
public void testFieldAccessFromDerived() throws Exception {
runTest("idea/testData/fir/multiModule/fieldAccessFromDerived/");
}
@TestMetadata("intersectionTypesProblem")
public void testIntersectionTypesProblem() throws Exception {
runTest("idea/testData/fir/multiModule/intersectionTypesProblem/");
}
@TestMetadata("javaGetPrefixConflict")
public void testJavaGetPrefixConflict() throws Exception {
runTest("idea/testData/fir/multiModule/javaGetPrefixConflict/");
}
@TestMetadata("javaInheritsKotlinDerived")
public void testJavaInheritsKotlinDerived() throws Exception {
runTest("idea/testData/fir/multiModule/javaInheritsKotlinDerived/");
}
@TestMetadata("javaInheritsKotlinExtension")
public void testJavaInheritsKotlinExtension() throws Exception {
runTest("idea/testData/fir/multiModule/javaInheritsKotlinExtension/");
}
@TestMetadata("javaInheritsKotlinProperty")
public void testJavaInheritsKotlinProperty() throws Exception {
runTest("idea/testData/fir/multiModule/javaInheritsKotlinProperty/");
}
@TestMetadata("javaInheritsRawKotlin")
public void testJavaInheritsRawKotlin() throws Exception {
runTest("idea/testData/fir/multiModule/javaInheritsRawKotlin/");
}
@TestMetadata("javaSyntheticProperty")
public void testJavaSyntheticProperty() throws Exception {
runTest("idea/testData/fir/multiModule/javaSyntheticProperty/");
}
@TestMetadata("mppFakeOverrides")
public void testMppFakeOverrides() throws Exception {
runTest("idea/testData/fir/multiModule/mppFakeOverrides/");
}
@TestMetadata("mppMemberType")
public void testMppMemberType() throws Exception {
runTest("idea/testData/fir/multiModule/mppMemberType/");
}
@TestMetadata("mppMembers")
public void testMppMembers() throws Exception {
runTest("idea/testData/fir/multiModule/mppMembers/");
}
@TestMetadata("mppSuperTypes")
public void testMppSuperTypes() throws Exception {
runTest("idea/testData/fir/multiModule/mppSuperTypes/");
}
@TestMetadata("overrideWithJava")
public void testOverrideWithJava() throws Exception {
runTest("idea/testData/fir/multiModule/overrideWithJava/");
}
@TestMetadata("withStdlib")
public void testWithStdlib() throws Exception {
runTest("idea/testData/fir/multiModule/withStdlib/");
}
}
@@ -0,0 +1,18 @@
/*
* Copyright 2010-2019 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.idea.fir
import org.jetbrains.kotlin.idea.AbstractResolveElementCacheTest
class FirResolveStateTest : AbstractResolveElementCacheTest() {
fun testSimpleStateCaching() {
doTest {
val firstStatement = statements[0]
val secondStatement = statements[1]
assertSame(firstStatement.firResolveState(), secondStatement.firResolveState())
}
}
}
@@ -0,0 +1,36 @@
/*
* Copyright 2010-2020 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.idea.resolve
import org.jetbrains.kotlin.idea.completion.test.configureWithExtraFile
import org.jetbrains.kotlin.idea.fir.FirResolution
import org.jetbrains.kotlin.test.InTextDirectivesUtils
abstract class AbstractFirReferenceResolveTest : AbstractReferenceResolveTest() {
override fun setUp() {
super.setUp()
FirResolution.enabled = true
}
override fun doTest(path: String) {
assert(path.endsWith(".kt")) { path }
myFixture.configureWithExtraFile(path, ".Data")
if (InTextDirectivesUtils.isDirectiveDefined(myFixture.file.text, "IGNORE_FIR")) {
try {
performChecks()
} catch (t: Throwable) {
return
}
throw AssertionError("Looks like test is passing, please remove IGNORE_FIR")
}
performChecks()
}
override fun tearDown() {
FirResolution.enabled = false
super.tearDown()
}
}
@@ -0,0 +1,624 @@
/*
* Copyright 2010-2020 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.idea.resolve;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
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.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/resolve/references")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class FirReferenceResolveTestGenerated extends AbstractFirReferenceResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInReferences() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("AnnotationForClass.kt")
public void testAnnotationForClass() throws Exception {
runTest("idea/testData/resolve/references/AnnotationForClass.kt");
}
@TestMetadata("AnnotationInsideFunction.kt")
public void testAnnotationInsideFunction() throws Exception {
runTest("idea/testData/resolve/references/AnnotationInsideFunction.kt");
}
@TestMetadata("AnnotationOnFile.kt")
public void testAnnotationOnFile() throws Exception {
runTest("idea/testData/resolve/references/AnnotationOnFile.kt");
}
@TestMetadata("AnnotationOnFileWithImport.kt")
public void testAnnotationOnFileWithImport() throws Exception {
runTest("idea/testData/resolve/references/AnnotationOnFileWithImport.kt");
}
@TestMetadata("AnnotationParameter.kt")
public void testAnnotationParameter() throws Exception {
runTest("idea/testData/resolve/references/AnnotationParameter.kt");
}
@TestMetadata("AnnotationTypeParameter.kt")
public void testAnnotationTypeParameter() throws Exception {
runTest("idea/testData/resolve/references/AnnotationTypeParameter.kt");
}
@TestMetadata("ClassInTypeConstraint.kt")
public void testClassInTypeConstraint() throws Exception {
runTest("idea/testData/resolve/references/ClassInTypeConstraint.kt");
}
@TestMetadata("ClassNameBeforeDot.kt")
public void testClassNameBeforeDot() throws Exception {
runTest("idea/testData/resolve/references/ClassNameBeforeDot.kt");
}
@TestMetadata("ClassObjectClassLiteralReference.kt")
public void testClassObjectClassLiteralReference() throws Exception {
runTest("idea/testData/resolve/references/ClassObjectClassLiteralReference.kt");
}
@TestMetadata("ClassObjectClassLiteralReferenceWithField.kt")
public void testClassObjectClassLiteralReferenceWithField() throws Exception {
runTest("idea/testData/resolve/references/ClassObjectClassLiteralReferenceWithField.kt");
}
@TestMetadata("ClassQualifierForNestedClassConstructorCall.kt")
public void testClassQualifierForNestedClassConstructorCall() throws Exception {
runTest("idea/testData/resolve/references/ClassQualifierForNestedClassConstructorCall.kt");
}
@TestMetadata("ClassReferenceInImport.kt")
public void testClassReferenceInImport() throws Exception {
runTest("idea/testData/resolve/references/ClassReferenceInImport.kt");
}
@TestMetadata("CollectionLiteralLeft.kt")
public void testCollectionLiteralLeft() throws Exception {
runTest("idea/testData/resolve/references/CollectionLiteralLeft.kt");
}
@TestMetadata("CollectionLiteralRight.kt")
public void testCollectionLiteralRight() throws Exception {
runTest("idea/testData/resolve/references/CollectionLiteralRight.kt");
}
@TestMetadata("CoroutineSuspensionPoint.kt")
public void testCoroutineSuspensionPoint() throws Exception {
runTest("idea/testData/resolve/references/CoroutineSuspensionPoint.kt");
}
@TestMetadata("CtrlClickResolve.kt")
public void testCtrlClickResolve() throws Exception {
runTest("idea/testData/resolve/references/CtrlClickResolve.kt");
}
@TestMetadata("DataClassCopy.kt")
public void testDataClassCopy() throws Exception {
runTest("idea/testData/resolve/references/DataClassCopy.kt");
}
@TestMetadata("DefaultObjectAsExtensionReceiverForFunction.kt")
public void testDefaultObjectAsExtensionReceiverForFunction() throws Exception {
runTest("idea/testData/resolve/references/DefaultObjectAsExtensionReceiverForFunction.kt");
}
@TestMetadata("DefaultObjectAsExtensionReceiverForProperty.kt")
public void testDefaultObjectAsExtensionReceiverForProperty() throws Exception {
runTest("idea/testData/resolve/references/DefaultObjectAsExtensionReceiverForProperty.kt");
}
@TestMetadata("DefaultObjectAsReceiverForExtensionFunctionOnSuperType.kt")
public void testDefaultObjectAsReceiverForExtensionFunctionOnSuperType() throws Exception {
runTest("idea/testData/resolve/references/DefaultObjectAsReceiverForExtensionFunctionOnSuperType.kt");
}
@TestMetadata("DefaultObjectAsReceiverForMemberPropertyInSuperType.kt")
public void testDefaultObjectAsReceiverForMemberPropertyInSuperType() throws Exception {
runTest("idea/testData/resolve/references/DefaultObjectAsReceiverForMemberPropertyInSuperType.kt");
}
@TestMetadata("DefaultObjectInShortReferenceFormCall.kt")
public void testDefaultObjectInShortReferenceFormCall() throws Exception {
runTest("idea/testData/resolve/references/DefaultObjectInShortReferenceFormCall.kt");
}
@TestMetadata("EnumValues.kt")
public void testEnumValues() throws Exception {
runTest("idea/testData/resolve/references/EnumValues.kt");
}
@TestMetadata("FakeJavaLang1.kt")
public void testFakeJavaLang1() throws Exception {
runTest("idea/testData/resolve/references/FakeJavaLang1.kt");
}
@TestMetadata("FakeJavaLang2.kt")
public void testFakeJavaLang2() throws Exception {
runTest("idea/testData/resolve/references/FakeJavaLang2.kt");
}
@TestMetadata("FakeJavaLang3.kt")
public void testFakeJavaLang3() throws Exception {
runTest("idea/testData/resolve/references/FakeJavaLang3.kt");
}
@TestMetadata("FakeJavaLang4.kt")
public void testFakeJavaLang4() throws Exception {
runTest("idea/testData/resolve/references/FakeJavaLang4.kt");
}
@TestMetadata("fileRefInRawStringLiteral.kt")
public void testFileRefInRawStringLiteral() throws Exception {
runTest("idea/testData/resolve/references/fileRefInRawStringLiteral.kt");
}
@TestMetadata("fileRefInStringLiteral.kt")
public void testFileRefInStringLiteral() throws Exception {
runTest("idea/testData/resolve/references/fileRefInStringLiteral.kt");
}
@TestMetadata("GenericFunctionParameter.kt")
public void testGenericFunctionParameter() throws Exception {
runTest("idea/testData/resolve/references/GenericFunctionParameter.kt");
}
@TestMetadata("GenericTypeInFunctionParameter.kt")
public void testGenericTypeInFunctionParameter() throws Exception {
runTest("idea/testData/resolve/references/GenericTypeInFunctionParameter.kt");
}
@TestMetadata("ImportFromRootScope.kt")
public void testImportFromRootScope() throws Exception {
runTest("idea/testData/resolve/references/ImportFromRootScope.kt");
}
@TestMetadata("InClassParameter.kt")
public void testInClassParameter() throws Exception {
runTest("idea/testData/resolve/references/InClassParameter.kt");
}
@TestMetadata("InClassParameterField.kt")
public void testInClassParameterField() throws Exception {
runTest("idea/testData/resolve/references/InClassParameterField.kt");
}
@TestMetadata("InEnumEntry.kt")
public void testInEnumEntry() throws Exception {
runTest("idea/testData/resolve/references/InEnumEntry.kt");
}
@TestMetadata("InFunctionParameterType.kt")
public void testInFunctionParameterType() throws Exception {
runTest("idea/testData/resolve/references/InFunctionParameterType.kt");
}
@TestMetadata("InMethodParameter.kt")
public void testInMethodParameter() throws Exception {
runTest("idea/testData/resolve/references/InMethodParameter.kt");
}
@TestMetadata("InObjectClassObject.kt")
public void testInObjectClassObject() throws Exception {
runTest("idea/testData/resolve/references/InObjectClassObject.kt");
}
@TestMetadata("InSecondClassObject.kt")
public void testInSecondClassObject() throws Exception {
runTest("idea/testData/resolve/references/InSecondClassObject.kt");
}
@TestMetadata("JavaAnnotationParameter.kt")
public void testJavaAnnotationParameter() throws Exception {
runTest("idea/testData/resolve/references/JavaAnnotationParameter.kt");
}
@TestMetadata("JavaConstructorNotNullParameter.kt")
public void testJavaConstructorNotNullParameter() throws Exception {
runTest("idea/testData/resolve/references/JavaConstructorNotNullParameter.kt");
}
@TestMetadata("JavaEnumEntry.kt")
public void testJavaEnumEntry() throws Exception {
runTest("idea/testData/resolve/references/JavaEnumEntry.kt");
}
@TestMetadata("JavaEnumValueOf.kt")
public void testJavaEnumValueOf() throws Exception {
runTest("idea/testData/resolve/references/JavaEnumValueOf.kt");
}
@TestMetadata("JavaParameter.kt")
public void testJavaParameter() throws Exception {
runTest("idea/testData/resolve/references/JavaParameter.kt");
}
@TestMetadata("JavaReference.kt")
public void testJavaReference() throws Exception {
runTest("idea/testData/resolve/references/JavaReference.kt");
}
@TestMetadata("MultiDeclarationExtension.kt")
public void testMultiDeclarationExtension() throws Exception {
runTest("idea/testData/resolve/references/MultiDeclarationExtension.kt");
}
@TestMetadata("MultiDeclarationMember.kt")
public void testMultiDeclarationMember() throws Exception {
runTest("idea/testData/resolve/references/MultiDeclarationMember.kt");
}
@TestMetadata("NamedClassObject.kt")
public void testNamedClassObject() throws Exception {
runTest("idea/testData/resolve/references/NamedClassObject.kt");
}
@TestMetadata("PackageReference.kt")
public void testPackageReference() throws Exception {
runTest("idea/testData/resolve/references/PackageReference.kt");
}
@TestMetadata("PackageReferenceInImport.kt")
public void testPackageReferenceInImport() throws Exception {
runTest("idea/testData/resolve/references/PackageReferenceInImport.kt");
}
@TestMetadata("PropertyPlaceInClassObjectInObject.kt")
public void testPropertyPlaceInClassObjectInObject() throws Exception {
runTest("idea/testData/resolve/references/PropertyPlaceInClassObjectInObject.kt");
}
@TestMetadata("ReferenceInClassWhereConstraint.kt")
public void testReferenceInClassWhereConstraint() throws Exception {
runTest("idea/testData/resolve/references/ReferenceInClassWhereConstraint.kt");
}
@TestMetadata("ReferenceInFunWhereConstraint.kt")
public void testReferenceInFunWhereConstraint() throws Exception {
runTest("idea/testData/resolve/references/ReferenceInFunWhereConstraint.kt");
}
@TestMetadata("ReferenceToSam.kt")
public void testReferenceToSam() throws Exception {
runTest("idea/testData/resolve/references/ReferenceToSam.kt");
}
@TestMetadata("ResolveClass.kt")
public void testResolveClass() throws Exception {
runTest("idea/testData/resolve/references/ResolveClass.kt");
}
@TestMetadata("ResolvePackageInProperty.kt")
public void testResolvePackageInProperty() throws Exception {
runTest("idea/testData/resolve/references/ResolvePackageInProperty.kt");
}
@TestMetadata("SamAdapter.kt")
public void testSamAdapter() throws Exception {
runTest("idea/testData/resolve/references/SamAdapter.kt");
}
@TestMetadata("SamConstructor.kt")
public void testSamConstructor() throws Exception {
runTest("idea/testData/resolve/references/SamConstructor.kt");
}
@TestMetadata("SamConstructorTypeArguments.kt")
public void testSamConstructorTypeArguments() throws Exception {
runTest("idea/testData/resolve/references/SamConstructorTypeArguments.kt");
}
@TestMetadata("SeveralOverrides.kt")
public void testSeveralOverrides() throws Exception {
runTest("idea/testData/resolve/references/SeveralOverrides.kt");
}
@TestMetadata("SyntheticProperty.kt")
public void testSyntheticProperty() throws Exception {
runTest("idea/testData/resolve/references/SyntheticProperty.kt");
}
@TestMetadata("TypeAlias.kt")
public void testTypeAlias() throws Exception {
runTest("idea/testData/resolve/references/TypeAlias.kt");
}
@TestMetadata("TypeAliasAsSupertypeConstructor.kt")
public void testTypeAliasAsSupertypeConstructor() throws Exception {
runTest("idea/testData/resolve/references/TypeAliasAsSupertypeConstructor.kt");
}
@TestMetadata("TypeAliasRHS.kt")
public void testTypeAliasRHS() throws Exception {
runTest("idea/testData/resolve/references/TypeAliasRHS.kt");
}
@TestMetadata("TypeArgumentBeforeDot.kt")
public void testTypeArgumentBeforeDot() throws Exception {
runTest("idea/testData/resolve/references/TypeArgumentBeforeDot.kt");
}
@TestMetadata("TypeArgumentBeforeDot2.kt")
public void testTypeArgumentBeforeDot2() throws Exception {
runTest("idea/testData/resolve/references/TypeArgumentBeforeDot2.kt");
}
@TestMetadata("TypeArgumentUnresolvedClass.kt")
public void testTypeArgumentUnresolvedClass() throws Exception {
runTest("idea/testData/resolve/references/TypeArgumentUnresolvedClass.kt");
}
@TestMetadata("TypeArgumentUnresolvedConstructor.kt")
public void testTypeArgumentUnresolvedConstructor() throws Exception {
runTest("idea/testData/resolve/references/TypeArgumentUnresolvedConstructor.kt");
}
@TestMetadata("TypeArgumentWrongNumber.kt")
public void testTypeArgumentWrongNumber() throws Exception {
runTest("idea/testData/resolve/references/TypeArgumentWrongNumber.kt");
}
@TestMetadata("TypeParameterInAnonymousObject.kt")
public void testTypeParameterInAnonymousObject() throws Exception {
runTest("idea/testData/resolve/references/TypeParameterInAnonymousObject.kt");
}
@TestMetadata("TypeParameterInFunctionLiteral.kt")
public void testTypeParameterInFunctionLiteral() throws Exception {
runTest("idea/testData/resolve/references/TypeParameterInFunctionLiteral.kt");
}
@TestMetadata("ValueParameter.kt")
public void testValueParameter() throws Exception {
runTest("idea/testData/resolve/references/ValueParameter.kt");
}
@TestMetadata("WrongNumberOfTypeArguments.kt")
public void testWrongNumberOfTypeArguments() throws Exception {
runTest("idea/testData/resolve/references/WrongNumberOfTypeArguments.kt");
}
@TestMetadata("WrongNumberOfTypeArguments2.kt")
public void testWrongNumberOfTypeArguments2() throws Exception {
runTest("idea/testData/resolve/references/WrongNumberOfTypeArguments2.kt");
}
@TestMetadata("WrongNumberOfTypeArgumentsInSupertype.kt")
public void testWrongNumberOfTypeArgumentsInSupertype() throws Exception {
runTest("idea/testData/resolve/references/WrongNumberOfTypeArgumentsInSupertype.kt");
}
@TestMetadata("idea/testData/resolve/references/delegatedPropertyAccessors")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegatedPropertyAccessors extends AbstractFirReferenceResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInDelegatedPropertyAccessors() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/delegatedPropertyAccessors"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("unresolved.kt")
public void testUnresolved() throws Exception {
runTest("idea/testData/resolve/references/delegatedPropertyAccessors/unresolved.kt");
}
@TestMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inSource")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class InSource extends AbstractFirReferenceResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInInSource() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/delegatedPropertyAccessors/inSource"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("getExtension.kt")
public void testGetExtension() throws Exception {
runTest("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getExtension.kt");
}
@TestMetadata("getMember.kt")
public void testGetMember() throws Exception {
runTest("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getMember.kt");
}
@TestMetadata("getMultipleDeclarations.kt")
public void testGetMultipleDeclarations() throws Exception {
runTest("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getMultipleDeclarations.kt");
}
@TestMetadata("getOneFakeOverride.kt")
public void testGetOneFakeOverride() throws Exception {
runTest("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getOneFakeOverride.kt");
}
}
@TestMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inStandardLibrary")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class InStandardLibrary extends AbstractFirReferenceResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInInStandardLibrary() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/delegatedPropertyAccessors/inStandardLibrary"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("lazy.kt")
public void testLazy() throws Exception {
runTest("idea/testData/resolve/references/delegatedPropertyAccessors/inStandardLibrary/lazy.kt");
}
@TestMetadata("notNull.kt")
public void testNotNull() throws Exception {
runTest("idea/testData/resolve/references/delegatedPropertyAccessors/inStandardLibrary/notNull.kt");
}
}
}
@TestMetadata("idea/testData/resolve/references/forLoopIn")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ForLoopIn extends AbstractFirReferenceResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInForLoopIn() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/forLoopIn"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("unresolvedIterator.kt")
public void testUnresolvedIterator() throws Exception {
runTest("idea/testData/resolve/references/forLoopIn/unresolvedIterator.kt");
}
@TestMetadata("idea/testData/resolve/references/forLoopIn/inBuiltIns")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class InBuiltIns extends AbstractFirReferenceResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInInBuiltIns() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/forLoopIn/inBuiltIns"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("extension.kt")
public void testExtension() throws Exception {
runTest("idea/testData/resolve/references/forLoopIn/inBuiltIns/extension.kt");
}
@TestMetadata("member.kt")
public void testMember() throws Exception {
runTest("idea/testData/resolve/references/forLoopIn/inBuiltIns/member.kt");
}
}
@TestMetadata("idea/testData/resolve/references/forLoopIn/inLibrary")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class InLibrary extends AbstractFirReferenceResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInInLibrary() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/forLoopIn/inLibrary"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("extension.kt")
public void testExtension() throws Exception {
runTest("idea/testData/resolve/references/forLoopIn/inLibrary/extension.kt");
}
}
@TestMetadata("idea/testData/resolve/references/forLoopIn/inSource")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class InSource extends AbstractFirReferenceResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("allExtensions.kt")
public void testAllExtensions() throws Exception {
runTest("idea/testData/resolve/references/forLoopIn/inSource/allExtensions.kt");
}
public void testAllFilesPresentInInSource() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/forLoopIn/inSource"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("allMembers.kt")
public void testAllMembers() throws Exception {
runTest("idea/testData/resolve/references/forLoopIn/inSource/allMembers.kt");
}
@TestMetadata("nextMissing.kt")
public void testNextMissing() throws Exception {
runTest("idea/testData/resolve/references/forLoopIn/inSource/nextMissing.kt");
}
}
}
@TestMetadata("idea/testData/resolve/references/invoke")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Invoke extends AbstractFirReferenceResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInInvoke() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/resolve/references/invoke"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("lambdaAndParens.kt")
public void testLambdaAndParens() throws Exception {
runTest("idea/testData/resolve/references/invoke/lambdaAndParens.kt");
}
@TestMetadata("lambdaNoPar.kt")
public void testLambdaNoPar() throws Exception {
runTest("idea/testData/resolve/references/invoke/lambdaNoPar.kt");
}
@TestMetadata("lambdaNoParLabel.kt")
public void testLambdaNoParLabel() throws Exception {
runTest("idea/testData/resolve/references/invoke/lambdaNoParLabel.kt");
}
@TestMetadata("lambdaNoParRCurly.kt")
public void testLambdaNoParRCurly() throws Exception {
runTest("idea/testData/resolve/references/invoke/lambdaNoParRCurly.kt");
}
@TestMetadata("noParams.kt")
public void testNoParams() throws Exception {
runTest("idea/testData/resolve/references/invoke/noParams.kt");
}
@TestMetadata("noParamsRPar.kt")
public void testNoParamsRPar() throws Exception {
runTest("idea/testData/resolve/references/invoke/noParamsRPar.kt");
}
@TestMetadata("nonemptyLambdaRPar.kt")
public void testNonemptyLambdaRPar() throws Exception {
runTest("idea/testData/resolve/references/invoke/nonemptyLambdaRPar.kt");
}
@TestMetadata("oneParam.kt")
public void testOneParam() throws Exception {
runTest("idea/testData/resolve/references/invoke/oneParam.kt");
}
@TestMetadata("oneParamRPar.kt")
public void testOneParamRPar() throws Exception {
runTest("idea/testData/resolve/references/invoke/oneParamRPar.kt");
}
}
}