[FIR IDE] Add Fir lightclasses tests and fix FindUsages tests

This commit is contained in:
Igor Yakovlev
2020-10-07 16:36:16 +03:00
committed by Ilya Kirillov
parent 3cefef03ff
commit dbb54c87bc
213 changed files with 3496 additions and 218 deletions
@@ -0,0 +1,46 @@
/*
* 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.asJava.classes
import com.intellij.openapi.application.ApplicationManager
import org.jetbrains.kotlin.asJava.KotlinAsJavaSupport
import org.jetbrains.kotlin.doTestWithFIRFlagsByPath
import org.jetbrains.kotlin.executeOnPooledThreadInReadAction
import org.jetbrains.kotlin.idea.debugger.readAction
import org.jetbrains.kotlin.idea.perf.UltraLightChecker
import org.jetbrains.kotlin.idea.perf.UltraLightChecker.checkByJavaFile
import org.jetbrains.kotlin.idea.perf.UltraLightChecker.getJavaFileForTest
import org.jetbrains.kotlin.idea.perf.UltraLightChecker.renderLightClasses
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.KotlinTestUtils
import java.io.File
abstract class AbstractFirClassLoadingTest : AbstractUltraLightClassLoadingTest() {
override fun isFirPlugin(): Boolean = true
override fun doTest(testDataPath: String) = doTestWithFIRFlagsByPath(testDataPath) {
doTestImpl(testDataPath)
}
private fun doTestImpl(testDataPath: String) {
val testDataFile = File(testDataPath)
val sourceText = testDataFile.readText()
val file = myFixture.addFileToProject(testDataPath, sourceText) as KtFile
val classFabric = KotlinAsJavaSupport.getInstance(project)
val expectedTextFile = getJavaFileForTest(testDataPath)
val renderedClasses = executeOnPooledThreadInReadAction {
val lightClasses = UltraLightChecker.allClasses(file).mapNotNull { classFabric.getLightClass(it) }
renderLightClasses(testDataPath, lightClasses)
}!!
KotlinTestUtils.assertEqualsToFile(expectedTextFile, renderedClasses)
}
}
@@ -0,0 +1,64 @@
/*
* 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.asJava.classes
import org.jetbrains.kotlin.asJava.LightClassTestCommon
import org.jetbrains.kotlin.doTestWithFIRFlagsByPath
import org.jetbrains.kotlin.executeOnPooledThreadInReadAction
import org.jetbrains.kotlin.idea.caches.resolve.PsiElementChecker
import org.jetbrains.kotlin.idea.caches.resolve.findClass
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.KotlinTestUtils
import java.io.File
abstract class AbstractFirLightClassTest : KotlinLightCodeInsightFixtureTestCase() {
override fun isFirPlugin(): Boolean = true
fun doTest(path: String) = doTestWithFIRFlagsByPath(path) {
doTestImpl()
}
private fun doTestImpl() {
val fileName = fileName()
val extraFilePath = when {
fileName.endsWith(fileExtension) -> fileName.replace(fileExtension, ".extra" + fileExtension)
else -> error("Invalid test data extension")
}
val testFiles = if (File(testDataPath, extraFilePath).isFile) listOf(fileName, extraFilePath) else listOf(fileName)
myFixture.configureByFiles(*testFiles.toTypedArray())
if ((myFixture.file as? KtFile)?.isScript() == true) {
error { "FIR for scripts does not supported yet" }
ScriptConfigurationManager.updateScriptDependenciesSynchronously(myFixture.file)
}
val ktFile = myFixture.file as KtFile
val testData = testDataFile()
val actual = executeOnPooledThreadInReadAction {
LightClassTestCommon.getActualLightClassText(
testData,
{ fqName ->
findClass(fqName, ktFile, project)?.apply {
PsiElementChecker.checkPsiElementStructure(this)
}
},
{ it }
)
}!!
KotlinTestUtils.assertEqualsToFile(KotlinTestUtils.replaceExtension(testData, "java"), actual)
}
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
open val fileExtension = ".kt"
}
@@ -0,0 +1,40 @@
/*
* 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.asJava.classes
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.asJava.KotlinAsJavaSupport
import org.jetbrains.kotlin.doTestWithFIRFlagsByPath
import org.jetbrains.kotlin.executeOnPooledThreadInReadAction
import org.jetbrains.kotlin.idea.perf.UltraLightChecker
import org.jetbrains.kotlin.idea.perf.UltraLightChecker.checkByJavaFile
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.test.KotlinTestUtils
abstract class AbstractFirLightFacadeClassTest : AbstractUltraLightFacadeClassTest() {
override fun isFirPlugin(): Boolean = true
override fun doTest(testDataPath: String) = doTestWithFIRFlagsByPath(testDataPath) {
super.doTest(testDataPath)
}
override fun checkLightFacades(testDataPath: String, facades: Collection<String>, scope: GlobalSearchScope) {
val expectedTextFile = UltraLightChecker.getJavaFileForTest(testDataPath)
val classFabric = KotlinAsJavaSupport.getInstance(project)
val renderedResult = executeOnPooledThreadInReadAction {
val lightClasses = facades.flatMap {
classFabric.getFacadeClasses(FqName(it), scope)
}.filterIsInstance<KtLightClass>()
UltraLightChecker.renderLightClasses(testDataPath, lightClasses)
}!!
KotlinTestUtils.assertEqualsToFile(expectedTextFile, renderedResult)
}
}
@@ -0,0 +1,195 @@
/*
* 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.asJava.classes;
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("compiler/testData/asJava/ultraLightClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class FirClassLoadingTestGenerated extends AbstractFirClassLoadingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInUltraLightClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/ultraLightClasses"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/annotationWithSetParamPropertyModifier.kt");
}
@TestMetadata("annotations.kt")
public void testAnnotations() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/annotations.kt");
}
@TestMetadata("classModifiers.kt")
public void testClassModifiers() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/classModifiers.kt");
}
@TestMetadata("constructors.kt")
public void testConstructors() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/constructors.kt");
}
@TestMetadata("coroutines.kt")
public void testCoroutines() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/coroutines.kt");
}
@TestMetadata("dataClasses.kt")
public void testDataClasses() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/dataClasses.kt");
}
@TestMetadata("delegatesWithAnnotations.kt")
public void testDelegatesWithAnnotations() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/delegatesWithAnnotations.kt");
}
@TestMetadata("delegatingToInterfaces.kt")
public void testDelegatingToInterfaces() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/delegatingToInterfaces.kt");
}
@TestMetadata("dollarsInNameLocal.kt")
public void testDollarsInNameLocal() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/dollarsInNameLocal.kt");
}
@TestMetadata("enums.kt")
public void testEnums() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/enums.kt");
}
@TestMetadata("generics.kt")
public void testGenerics() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/generics.kt");
}
@TestMetadata("implementingKotlinCollections.kt")
public void testImplementingKotlinCollections() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/implementingKotlinCollections.kt");
}
@TestMetadata("importAliases.kt")
public void testImportAliases() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/importAliases.kt");
}
@TestMetadata("inferringAnonymousObjectTypes.kt")
public void testInferringAnonymousObjectTypes() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/inferringAnonymousObjectTypes.kt");
}
@TestMetadata("inheritance.kt")
public void testInheritance() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/inheritance.kt");
}
@TestMetadata("inlineClasses.kt")
public void testInlineClasses() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/inlineClasses.kt");
}
@TestMetadata("inlineOnly.kt")
public void testInlineOnly() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/inlineOnly.kt");
}
@TestMetadata("inlineReified.kt")
public void testInlineReified() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/inlineReified.kt");
}
@TestMetadata("jvmField.kt")
public void testJvmField() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/jvmField.kt");
}
@TestMetadata("jvmName.kt")
public void testJvmName() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/jvmName.kt");
}
@TestMetadata("jvmOverloads.kt")
public void testJvmOverloads() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/jvmOverloads.kt");
}
@TestMetadata("jvmSynthetic.kt")
public void testJvmSynthetic() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/jvmSynthetic.kt");
}
@TestMetadata("jvmSyntheticForAccessors.kt")
public void testJvmSyntheticForAccessors() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/jvmSyntheticForAccessors.kt");
}
@TestMetadata("jvmWildcardAnnotations.kt")
public void testJvmWildcardAnnotations() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/jvmWildcardAnnotations.kt");
}
@TestMetadata("lateinitProperty.kt")
public void testLateinitProperty() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/lateinitProperty.kt");
}
@TestMetadata("localClassDerived.kt")
public void testLocalClassDerived() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/localClassDerived.kt");
}
@TestMetadata("objects.kt")
public void testObjects() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/objects.kt");
}
@TestMetadata("properties.kt")
public void testProperties() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/properties.kt");
}
@TestMetadata("simpleFunctions.kt")
public void testSimpleFunctions() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/simpleFunctions.kt");
}
@TestMetadata("throwsAnnotation.kt")
public void testThrowsAnnotation() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/throwsAnnotation.kt");
}
@TestMetadata("typeAliases.kt")
public void testTypeAliases() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/typeAliases.kt");
}
@TestMetadata("typeAnnotations.kt")
public void testTypeAnnotations() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/typeAnnotations.kt");
}
@TestMetadata("wildcardOptimization.kt")
public void testWildcardOptimization() throws Exception {
runTest("compiler/testData/asJava/ultraLightClasses/wildcardOptimization.kt");
}
}
@@ -0,0 +1,493 @@
/*
* 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.asJava.classes;
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("compiler/testData/asJava/lightClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class FirLightClassTestGenerated extends AbstractFirLightClassTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLightClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "delegation", "script");
}
@TestMetadata("AnnotatedParameterInEnumConstructor.kt")
public void testAnnotatedParameterInEnumConstructor() throws Exception {
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInEnumConstructor.kt");
}
@TestMetadata("AnnotatedParameterInInnerClassConstructor.kt")
public void testAnnotatedParameterInInnerClassConstructor() throws Exception {
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInInnerClassConstructor.kt");
}
@TestMetadata("AnnotatedPropertyWithSites.kt")
public void testAnnotatedPropertyWithSites() throws Exception {
runTest("compiler/testData/asJava/lightClasses/AnnotatedPropertyWithSites.kt");
}
@TestMetadata("AnnotationClass.kt")
public void testAnnotationClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
}
@TestMetadata("DataClassWithCustomImplementedMembers.kt")
public void testDataClassWithCustomImplementedMembers() throws Exception {
runTest("compiler/testData/asJava/lightClasses/DataClassWithCustomImplementedMembers.kt");
}
@TestMetadata("DelegatedNested.kt")
public void testDelegatedNested() throws Exception {
runTest("compiler/testData/asJava/lightClasses/DelegatedNested.kt");
}
@TestMetadata("Delegation.kt")
public void testDelegation() throws Exception {
runTest("compiler/testData/asJava/lightClasses/Delegation.kt");
}
@TestMetadata("DeprecatedEnumEntry.kt")
public void testDeprecatedEnumEntry() throws Exception {
runTest("compiler/testData/asJava/lightClasses/DeprecatedEnumEntry.kt");
}
@TestMetadata("DeprecatedNotHiddenInClass.kt")
public void testDeprecatedNotHiddenInClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/DeprecatedNotHiddenInClass.kt");
}
@TestMetadata("DollarsInName.kt")
public void testDollarsInName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/DollarsInName.kt");
}
@TestMetadata("DollarsInNameNoPackage.kt")
public void testDollarsInNameNoPackage() throws Exception {
runTest("compiler/testData/asJava/lightClasses/DollarsInNameNoPackage.kt");
}
@TestMetadata("ExtendingInterfaceWithDefaultImpls.kt")
public void testExtendingInterfaceWithDefaultImpls() throws Exception {
runTest("compiler/testData/asJava/lightClasses/ExtendingInterfaceWithDefaultImpls.kt");
}
@TestMetadata("HiddenDeprecated.kt")
public void testHiddenDeprecated() throws Exception {
runTest("compiler/testData/asJava/lightClasses/HiddenDeprecated.kt");
}
@TestMetadata("HiddenDeprecatedInClass.kt")
public void testHiddenDeprecatedInClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/HiddenDeprecatedInClass.kt");
}
@TestMetadata("InheritingInterfaceDefaultImpls.kt")
public void testInheritingInterfaceDefaultImpls() throws Exception {
runTest("compiler/testData/asJava/lightClasses/InheritingInterfaceDefaultImpls.kt");
}
@TestMetadata("InlineReified.kt")
public void testInlineReified() throws Exception {
runTest("compiler/testData/asJava/lightClasses/InlineReified.kt");
}
@TestMetadata("JvmNameOnMember.kt")
public void testJvmNameOnMember() throws Exception {
runTest("compiler/testData/asJava/lightClasses/JvmNameOnMember.kt");
}
@TestMetadata("JvmStatic.kt")
public void testJvmStatic() throws Exception {
runTest("compiler/testData/asJava/lightClasses/JvmStatic.kt");
}
@TestMetadata("NestedObjects.kt")
public void testNestedObjects() throws Exception {
runTest("compiler/testData/asJava/lightClasses/NestedObjects.kt");
}
@TestMetadata("NonDataClassWithComponentFunctions.kt")
public void testNonDataClassWithComponentFunctions() throws Exception {
runTest("compiler/testData/asJava/lightClasses/NonDataClassWithComponentFunctions.kt");
}
@TestMetadata("PublishedApi.kt")
public void testPublishedApi() throws Exception {
runTest("compiler/testData/asJava/lightClasses/PublishedApi.kt");
}
@TestMetadata("SpecialAnnotationsOnAnnotationClass.kt")
public void testSpecialAnnotationsOnAnnotationClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass.kt");
}
@TestMetadata("StubOrderForOverloads.kt")
public void testStubOrderForOverloads() throws Exception {
runTest("compiler/testData/asJava/lightClasses/StubOrderForOverloads.kt");
}
@TestMetadata("TypePararametersInClass.kt")
public void testTypePararametersInClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/TypePararametersInClass.kt");
}
@TestMetadata("VarArgs.kt")
public void testVarArgs() throws Exception {
runTest("compiler/testData/asJava/lightClasses/VarArgs.kt");
}
@TestMetadata("compiler/testData/asJava/lightClasses/compilationErrors")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CompilationErrors extends AbstractFirLightClassTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("ActualClass.kt")
public void testActualClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ActualClass.kt");
}
@TestMetadata("ActualTypeAlias.kt")
public void testActualTypeAlias() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ActualTypeAlias.kt");
}
@TestMetadata("ActualTypeAliasCustomJvmPackageName.kt")
public void testActualTypeAliasCustomJvmPackageName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ActualTypeAliasCustomJvmPackageName.kt");
}
public void testAllFilesPresentInCompilationErrors() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("AllInlineOnly.kt")
public void testAllInlineOnly() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/AllInlineOnly.kt");
}
@TestMetadata("AnnotationModifiers.kt")
public void testAnnotationModifiers() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/AnnotationModifiers.kt");
}
@TestMetadata("EnumNameOverride.kt")
public void testEnumNameOverride() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/EnumNameOverride.kt");
}
@TestMetadata("ExpectClass.kt")
public void testExpectClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ExpectClass.kt");
}
@TestMetadata("ExpectObject.kt")
public void testExpectObject() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ExpectObject.kt");
}
@TestMetadata("ExpectedNestedClass.kt")
public void testExpectedNestedClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClass.kt");
}
@TestMetadata("ExpectedNestedClassInObject.kt")
public void testExpectedNestedClassInObject() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClassInObject.kt");
}
@TestMetadata("JvmPackageName.kt")
public void testJvmPackageName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/JvmPackageName.kt");
}
@TestMetadata("LocalInAnnotation.kt")
public void testLocalInAnnotation() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/LocalInAnnotation.kt");
}
@TestMetadata("PrivateInTrait.kt")
public void testPrivateInTrait() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PrivateInTrait.kt");
}
@TestMetadata("RepetableAnnotations.kt")
public void testRepetableAnnotations() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/RepetableAnnotations.kt");
}
@TestMetadata("SameName.kt")
public void testSameName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/SameName.kt");
}
@TestMetadata("TopLevelDestructuring.kt")
public void testTopLevelDestructuring() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/TopLevelDestructuring.kt");
}
@TestMetadata("TraitClassObjectField.kt")
public void testTraitClassObjectField() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/TraitClassObjectField.kt");
}
@TestMetadata("TwoOverrides.kt")
public void testTwoOverrides() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/TwoOverrides.kt");
}
@TestMetadata("WrongAnnotations.kt")
public void testWrongAnnotations() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/WrongAnnotations.kt");
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/facades")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Facades extends AbstractFirLightClassTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInFacades() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("AllPrivate.kt")
public void testAllPrivate() throws Exception {
runTest("compiler/testData/asJava/lightClasses/facades/AllPrivate.kt");
}
@TestMetadata("MultiFile.kt")
public void testMultiFile() throws Exception {
runTest("compiler/testData/asJava/lightClasses/facades/MultiFile.kt");
}
@TestMetadata("SingleFile.kt")
public void testSingleFile() throws Exception {
runTest("compiler/testData/asJava/lightClasses/facades/SingleFile.kt");
}
@TestMetadata("SingleJvmClassName.kt")
public void testSingleJvmClassName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/facades/SingleJvmClassName.kt");
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/ideRegression")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class IdeRegression extends AbstractFirLightClassTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInIdeRegression() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/ideRegression"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("AllOpenAnnotatedClasses.kt")
public void testAllOpenAnnotatedClasses() throws Exception {
runTest("compiler/testData/asJava/lightClasses/ideRegression/AllOpenAnnotatedClasses.kt");
}
@TestMetadata("ImplementingCharSequenceAndNumber.kt")
public void testImplementingCharSequenceAndNumber() throws Exception {
runTest("compiler/testData/asJava/lightClasses/ideRegression/ImplementingCharSequenceAndNumber.kt");
}
@TestMetadata("ImplementingMap.kt")
public void testImplementingMap() throws Exception {
runTest("compiler/testData/asJava/lightClasses/ideRegression/ImplementingMap.kt");
}
@TestMetadata("ImplementingMutableSet.kt")
public void testImplementingMutableSet() throws Exception {
runTest("compiler/testData/asJava/lightClasses/ideRegression/ImplementingMutableSet.kt");
}
@TestMetadata("InheritingInterfaceDefaultImpls.kt")
public void testInheritingInterfaceDefaultImpls() throws Exception {
runTest("compiler/testData/asJava/lightClasses/ideRegression/InheritingInterfaceDefaultImpls.kt");
}
@TestMetadata("OverridingFinalInternal.kt")
public void testOverridingFinalInternal() throws Exception {
runTest("compiler/testData/asJava/lightClasses/ideRegression/OverridingFinalInternal.kt");
}
@TestMetadata("OverridingInternal.kt")
public void testOverridingInternal() throws Exception {
runTest("compiler/testData/asJava/lightClasses/ideRegression/OverridingInternal.kt");
}
@TestMetadata("OverridingProtected.kt")
public void testOverridingProtected() throws Exception {
runTest("compiler/testData/asJava/lightClasses/ideRegression/OverridingProtected.kt");
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class NullabilityAnnotations extends AbstractFirLightClassTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInNullabilityAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("Class.kt")
public void testClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Class.kt");
}
@TestMetadata("ClassObjectField.kt")
public void testClassObjectField() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/ClassObjectField.kt");
}
@TestMetadata("ClassWithConstructor.kt")
public void testClassWithConstructor() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/ClassWithConstructor.kt");
}
@TestMetadata("ClassWithConstructorAndProperties.kt")
public void testClassWithConstructorAndProperties() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/ClassWithConstructorAndProperties.kt");
}
@TestMetadata("FileFacade.kt")
public void testFileFacade() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/FileFacade.kt");
}
@TestMetadata("Generic.kt")
public void testGeneric() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Generic.kt");
}
@TestMetadata("IntOverridesAny.kt")
public void testIntOverridesAny() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/IntOverridesAny.kt");
}
@TestMetadata("JvmOverloads.kt")
public void testJvmOverloads() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt");
}
@TestMetadata("NullableUnitReturn.kt")
public void testNullableUnitReturn() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/NullableUnitReturn.kt");
}
@TestMetadata("OverrideAnyWithUnit.kt")
public void testOverrideAnyWithUnit() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/OverrideAnyWithUnit.kt");
}
@TestMetadata("PlatformTypes.kt")
public void testPlatformTypes() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/PlatformTypes.kt");
}
@TestMetadata("Primitives.kt")
public void testPrimitives() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Primitives.kt");
}
@TestMetadata("PrivateInClass.kt")
public void testPrivateInClass() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.kt");
}
@TestMetadata("Synthetic.kt")
public void testSynthetic() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Synthetic.kt");
}
@TestMetadata("Trait.kt")
public void testTrait() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Trait.kt");
}
@TestMetadata("UnitAsGenericArgument.kt")
public void testUnitAsGenericArgument() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/UnitAsGenericArgument.kt");
}
@TestMetadata("UnitParameter.kt")
public void testUnitParameter() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/UnitParameter.kt");
}
@TestMetadata("VoidReturn.kt")
public void testVoidReturn() throws Exception {
runTest("compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.kt");
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/object")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Object extends AbstractFirLightClassTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInObject() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("SimpleObject.kt")
public void testSimpleObject() throws Exception {
runTest("compiler/testData/asJava/lightClasses/object/SimpleObject.kt");
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/publicField")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class PublicField extends AbstractFirLightClassTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInPublicField() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("CompanionObject.kt")
public void testCompanionObject() throws Exception {
runTest("compiler/testData/asJava/lightClasses/publicField/CompanionObject.kt");
}
@TestMetadata("Simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/asJava/lightClasses/publicField/Simple.kt");
}
}
}
@@ -0,0 +1,95 @@
/*
* 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.asJava.classes;
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("compiler/testData/asJava/ultraLightFacades")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class FirLightFacadeClassTestGenerated extends AbstractFirLightFacadeClassTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInUltraLightFacades() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/ultraLightFacades"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("coroutines.kt")
public void testCoroutines() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/coroutines.kt");
}
@TestMetadata("importAliases.kt")
public void testImportAliases() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/importAliases.kt");
}
@TestMetadata("inlineOnly.kt")
public void testInlineOnly() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/inlineOnly.kt");
}
@TestMetadata("jvmField.kt")
public void testJvmField() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/jvmField.kt");
}
@TestMetadata("jvmName.kt")
public void testJvmName() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/jvmName.kt");
}
@TestMetadata("jvmWildcardAnnotations.kt")
public void testJvmWildcardAnnotations() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/jvmWildcardAnnotations.kt");
}
@TestMetadata("lateinitProperty.kt")
public void testLateinitProperty() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/lateinitProperty.kt");
}
@TestMetadata("multifileFacade.kt")
public void testMultifileFacade() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/multifileFacade.kt");
}
@TestMetadata("multifileFacadeJvmName.kt")
public void testMultifileFacadeJvmName() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/multifileFacadeJvmName.kt");
}
@TestMetadata("properties.kt")
public void testProperties() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/properties.kt");
}
@TestMetadata("simpleFunctions.kt")
public void testSimpleFunctions() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/simpleFunctions.kt");
}
@TestMetadata("throwsAnnotation.kt")
public void testThrowsAnnotation() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/throwsAnnotation.kt");
}
@TestMetadata("wildcardOptimization.kt")
public void testWildcardOptimization() throws Exception {
runTest("compiler/testData/asJava/ultraLightFacades/wildcardOptimization.kt");
}
}
@@ -1,6 +1,7 @@
// PSI_ELEMENT: com.intellij.psi.PsiField
// OPTIONS: skipWrite
// FIR_COMPARISON
public class A {
public String <caret>foo = "foo";
}
}
// FIR_COMPARISON
@@ -1,6 +1,5 @@
// PSI_ELEMENT: com.intellij.psi.PsiMethod
// OPTIONS: usages
// FIR_COMPARISON
class A {
public void <caret>foo() {
@@ -12,4 +11,6 @@ class B extends A {
public void foo() {
}
}
}
// FIR_COMPARISON
@@ -1,6 +1,5 @@
// PSI_ELEMENT: com.intellij.psi.PsiMethod
// OPTIONS: usages
// FIR_COMPARISON
public class Bar {
public String getValue() {
return "value";
@@ -9,4 +8,6 @@ public class Bar {
public String <caret>getValue(String param) {
return "value " + param;
}
}
}
// FIR_COMPARISON
@@ -26,4 +26,6 @@ class Test {
new B().getP();
new B().setP(1);
}
}
}
// FIR_IGNORE
@@ -26,4 +26,6 @@ class Test {
new B().getP();
new B().setP(1);
}
}
}
// FIR_IGNORE
@@ -1,7 +1,8 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
package pack
data class A(val <caret>a: Int, val b: String)
data class A(val <caret>a: Int, val b: String)
// FIR_IGNORE
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>a: Int, val b: Int) {
fun f() {}
@@ -24,4 +23,6 @@ fun foo(x: X) {
val (a3, b3) = constructor(1, 2)
val (a4, b4) = A::class.java.newInstance()
}
}
// FIR_IGNORE
@@ -1,4 +1,4 @@
Value read 20 val (a1, b1) = fun2()
Value read 21 val (a2, b2) = fun3()
Value read 24 val (a3, b3) = constructor(1, 2)
Value read 26 val (a4, b4) = A::class.java.newInstance()
Value read 19 val (a1, b1) = fun2()
Value read 20 val (a2, b2) = fun3()
Value read 23 val (a3, b3) = constructor(1, 2)
Value read 25 val (a4, b4) = A::class.java.newInstance()
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_COMPARISON
data class A(val <caret>x: Int, val y: Int) {
companion object {
@@ -14,4 +13,5 @@ fun foo() {
val (x, y) = A.b()
}
// DISABLE-ERRORS
// DISABLE-ERRORS
// FIR_COMPARISON
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
package pack
@@ -27,3 +26,5 @@ fun List<A>.ext1() {
}
fun <T> T.getThis(): T = this
// FIR_IGNORE
@@ -1,5 +1,5 @@
[dataClass.0.kt] Value read 18 val (x, y) = getThis()
[dataClass.0.kt] Value read 26 val (x, y) = get(0)
[dataClass.0.kt] Value read 17 val (x, y) = getThis()
[dataClass.0.kt] Value read 25 val (x, y) = get(0)
[dataClass.1.kt] Function call 6 a.component1()
[dataClass.1.kt] Value read 10 val (x2, y2, z2) = g()
[dataClass.1.kt] Value read 11 val (x3, y3, z3) = h()
@@ -1,7 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIND_BY_REF
// FIR_IGNORE
data class A(val n: Int, val s: String, val o: Any)
@@ -11,3 +10,5 @@ fun test() {
a.<caret>component1()
val (x, y, z) = a
}
// FIR_IGNORE
@@ -1 +1 @@
Value read 10 a.n
Value read 9 a.n
@@ -1,3 +1,3 @@
Function call 11 a.component1()
Value read 10 a.n
Value read 12 val (x, y, z) = a
Function call 10 a.component1()
Value read 11 val (x, y, z) = a
Value read 9 a.n
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>x: Int, val y: Int, val z: String)
data class B(val a: A, val n: Int)
@@ -16,4 +15,6 @@ fun f(b: B, c: C) {
val (a1, n1) = c
val (x1, y1, z1) = a1
}
}
// FIR_IGNORE
@@ -1 +1 @@
Value read 15 val (x, y, z) = a
Value read 14 val (x, y, z) = a
@@ -1,2 +1,2 @@
Value read 15 val (x, y, z) = a
Value read 18 val (x1, y1, z1) = a1
Value read 14 val (x, y, z) = a
Value read 17 val (x1, y1, z1) = a1
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>n: Int, val s: String, val o: Any) {
@@ -12,3 +11,5 @@ fun test() {
val (x, y) = a
}
}
// FIR_IGNORE
@@ -1,2 +1,2 @@
Value read 12 val (x, y) = a
Value read 8 for ((x, y, z) in arrayOf<A>()) {
Value read 11 val (x, y) = a
Value read 7 for ((x, y, z) in arrayOf<A>()) {
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>x: Int, val y: Int)
@@ -15,4 +14,5 @@ fun y(o: Any) {
val list = o as List<A>
val (x, y) = list[0]
}
// DISABLE-ERRORS
// DISABLE-ERRORS
// FIR_IGNORE
@@ -1,2 +1,2 @@
Value read 16 val (x, y) = list[0]
Value read 9 val (x, y) = o
Value read 15 val (x, y) = list[0]
Value read 8 val (x, y) = o
@@ -1,3 +1,3 @@
Value read 10 val (x1, y1) = A(1, "", "")
Value read 16 val (x, y) = list[0]
Value read 9 val (x, y) = o
Value read 15 val (x, y) = list[0]
Value read 8 val (x, y) = o
Value read 9 val (x1, y1) = A(1, "", "")
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>a: Int, val b: Int)
@@ -39,4 +38,6 @@ var Any.v: (A) -> Unit
fun f() {
"".v = { val (x, y ) = it }
}
}
// FIR_IGNORE
@@ -1 +1 @@
Value read 29 takeFun2 { a, n -> val (x, y) = a!! }
Value read 28 takeFun2 { a, n -> val (x, y) = a!! }
@@ -1,8 +1,8 @@
Value read 20 p[0] = { val (x, y) = it }
Value read 26 takeExtFun { val (x, y) = this }
Value read 28 takeFun1 { val (x, y) = it }
Value read 29 takeFun2 { a, n -> val (x, y) = a!! }
Value read 30 takeFun3 { val (x, y) = it[0] }
Value read 32 x(p) { val (x, y) = it }
Value read 33 x(p, fun (p) { val (x, y) = p })
Value read 41 "".v = { val (x, y ) = it }
Value read 19 p[0] = { val (x, y) = it }
Value read 25 takeExtFun { val (x, y) = this }
Value read 27 takeFun1 { val (x, y) = it }
Value read 28 takeFun2 { a, n -> val (x, y) = a!! }
Value read 29 takeFun3 { val (x, y) = it[0] }
Value read 31 x(p) { val (x, y) = it }
Value read 32 x(p, fun (p) { val (x, y) = p })
Value read 40 "".v = { val (x, y ) = it }
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>n: Int, val s: String)
@@ -34,3 +33,5 @@ fun y2(a: A): Boolean = condition(a)
fun y3(a: A) {
condition(a)
}
// FIR_IGNORE
@@ -1,2 +1,2 @@
Value read 20 val (x1, y1) = if (b) {
Value read 21 A(1, "").apply { val (x2, y2) = this }
Value read 19 val (x1, y1) = if (b) {
Value read 20 A(1, "").apply { val (x2, y2) = this }
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
data class A(val <caret>x: Int, val y: Int) {
fun f() {
@@ -1,10 +1,11 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_COMPARISON
data class A(val <caret>a: A?, val n: Int)
fun f(a: A) {
val (a1, n1) = a
val (a2, n2) =
a?.a ?: return
}
}
// FIR_COMPARISON
@@ -1,3 +1,3 @@
Value read 7 val (a1, n1) = a
Value read 8 val (a2, n2) =
Value read 9 a?.a ?: return
Value read 6 val (a1, n1) = a
Value read 7 val (a2, n2) =
Value read 8 a?.a ?: return
@@ -1,3 +1,3 @@
Value read 7 val (a1, n1) = a
Value read 8 val (a2, n2) =
Value read 9 a?.a ?: return
Value read 6 val (a1, n1) = a
Value read 7 val (a2, n2) =
Value read 8 a?.a ?: return
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
data class A(val <caret>b: B, val n: Int)
data class B(val a: A?, val s: String)
@@ -5,3 +5,5 @@ package test
class <caret>Foo {
}
// FIR_COMPARISON
@@ -11,3 +11,5 @@ open class <caret>Server {
println("Server")
}
}
// FIR_COMPARISON
@@ -4,3 +4,5 @@ package testing
class <caret>Server() {
}
// FIR_COMPARISON
@@ -1,4 +1,4 @@
Field declaration 4 private Server myServer = new Server();
Method parameter declaration 6 public void setServer(Server server) {
Method return type 10 public Server getMyServer() {
New instance creation 4 private Server myServer = new Server();
New instance creation 4 private Server myServer = new Server();
@@ -4,3 +4,5 @@ package testing
class <caret>Server() {
}
// FIR_COMPARISON
@@ -35,3 +35,5 @@ open class A: X {
println("!$s!")
}
}
// FIR_COMPARISON
@@ -35,3 +35,5 @@ open class <caret>A: X {
println("!$s!")
}
}
// FIR_COMPARISON
@@ -3,3 +3,5 @@
open class <caret>A {
constructor() {}
}
// FIR_COMPARISON
@@ -1,8 +1,9 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_COMPARISON
package server
data class <caret>Data
// DISABLE-ERRORS
// DISABLE-ERRORS
// FIR_COMPARISON
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages, skipImports
// FIR_COMPARISON
package server
@@ -9,3 +8,5 @@ open class <caret>Server {
println("Server")
}
}
// FIR_COMPARISON
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: functionUsages
// FIR_COMPARISON
interface <caret>X {
val a: String
@@ -37,3 +36,5 @@ open class A: X {
println("!$s!")
}
}
// FIR_COMPARISON
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: functionUsages
// FIR_COMPARISON
interface X {
val a: String
@@ -37,3 +36,5 @@ open class <caret>A: X {
println("!$s!")
}
}
// FIR_COMPARISON
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: propertyUsages
// FIR_COMPARISON
interface <caret>X {
val a: String
@@ -37,3 +36,5 @@ open class A: X {
println("!$s!")
}
}
// FIR_COMPARISON
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: propertyUsages
// FIR_COMPARISON
interface X {
val a: String
@@ -37,3 +36,5 @@ open class <caret>A(val t: String, var u: String): X {
println("!$s!")
}
}
// FIR_COMPARISON
@@ -11,3 +11,5 @@ public open class Outer {
}
}
}
// FIR_COMPARISON
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_IGNORE
// FIR_COMPARISON
fun foo(): Any {
class <caret>Bar
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_IGNORE
// FIR_COMPARISON
fun foo(): Any {
if (false) {
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_IGNORE
// FIR_COMPARISON
package server
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_IGNORE
// FIR_COMPARISON
class <caret>C {
init {
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
class <caret>A<T>
@@ -24,4 +24,5 @@ enum class E {
open fun <caret>foo(n: Int): Int = n
}
// DISABLE-ERRORS
// DISABLE-ERRORS
// FIR_IGNORE
@@ -1,6 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: textOccurrences
// FIR_COMPARISON
package test
@@ -9,3 +8,5 @@ class Foo {
}
}
// FIR_COMPARISON
@@ -1,7 +1,8 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_COMPARISON
package server
fun <caret>processRequest() = "foo"
// FIR_COMPARISON
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
fun foo() {
fun <caret>bar() {
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
fun foo() {
if (true) {
@@ -13,3 +13,5 @@ class Client {
processRequest()
}
}
// FIR_COMPARISON
@@ -1,7 +1,6 @@
// IGNORE: see KotlinFindUsagesHandlerFactory: it is ambiguous case: ImportAlias does not have any reference to be resolved
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtImportAlias
// OPTIONS: usages
// FIR_COMPARISON
package c
@@ -16,4 +15,6 @@ fun test() {
a(1)
b()
b(1)
}
}
// FIR_COMPARISON
@@ -9,3 +9,5 @@ public open class Outer() {
}
}
}
// FIR_COMPARISON
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
package server
@@ -4,3 +4,4 @@ package server
fun <caret>processRequest() = "foo"
// FIR_COMPARISON
@@ -6,3 +6,4 @@ package server
fun <caret>processRequest() = "foo"
// FIR_COMPARISON
@@ -1,8 +1,8 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages, skipImports
// FIR_COMPARISON
package server
fun <caret>processRequest() = "foo"
// FIR_COMPARISON
@@ -5,3 +5,4 @@ package server
fun <caret>processRequest() = "foo"
// FIR_COMPARISON
@@ -8,4 +8,6 @@ interface TraitWithImpl {
public class TraitWithDelegatedWithImpl(f: TraitWithImpl): TraitWithImpl by f
fun test(twdwi: TraitWithDelegatedWithImpl) = twdwi.foo()
fun test(twdwi: TraitWithDelegatedWithImpl) = twdwi.foo()
// FIR_COMPARISON
@@ -1,2 +1,2 @@
[kotlinTraitImplThroughDelegate.0.kt] Function call 11 fun test(twdwi: TraitWithDelegatedWithImpl) = twdwi.foo()
[kotlinTraitImplThroughDelegate.1.java] Unclassified usage 7 some.foo();
[kotlinTraitImplThroughDelegate.1.java] Unclassified usage 7 some.foo();
@@ -8,4 +8,6 @@ interface TraitNoImpl {
public class TraitWithDelegatedNoImpl(f: TraitNoImpl): TraitNoImpl by f
fun test(twdni: TraitWithDelegatedNoImpl) = twdni.foo()
fun test(twdni: TraitWithDelegatedNoImpl) = twdni.foo()
// FIR_COMPARISON
@@ -1,2 +1,2 @@
[kotlinTraitNoImplThroughDelegate.0.kt] Function call 11 fun test(twdni: TraitWithDelegatedNoImpl) = twdni.foo()
[kotlinTraitNoImplThroughDelegate.1.java] Unclassified usage 7 some.foo();
[kotlinTraitNoImplThroughDelegate.1.java] Unclassified usage 7 some.foo();
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
package anonymousUnused
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
package anonymousUnused
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
package anonymousUnused
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
package anonymousUnused
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
class Foo {
private val localObject = object : Any() {
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
class Foo {
companion object {
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
private val localObject = object : Any() {
fun <caret>f() {
@@ -14,3 +14,4 @@ fun main(a: A) {
}
// for KT-3769 Find usages gives no result for overrides
// FIR_COMPARISON
@@ -26,4 +26,5 @@ fun test() {
B().p = 1
}
// DISABLE-ERRORS
// DISABLE-ERRORS
// FIR_IGNORE
@@ -27,4 +27,5 @@ fun test() {
B().p = 1
}
// DISABLE-ERRORS
// DISABLE-ERRORS
// FIR_IGNORE
@@ -27,4 +27,5 @@ fun test() {
B().p = 1
}
// DISABLE-ERRORS
// DISABLE-ERRORS
// FIR_IGNORE
@@ -5,3 +5,4 @@ object <caret>O {
var foo: String = "foo"
}
// FIR_COMPARISON
@@ -1,2 +1,2 @@
Class static member access 7 System.out.println("foo = " + O.INSTANCE.getFoo());
Usage in import 3 import server.O;
Usage in import 3 import server.O;
@@ -1,5 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// FIR_IGNORE
// FIR_COMPARISON
import Imported as Alias
@@ -1,5 +1,4 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// FIR_COMPARISON
package server
@@ -7,3 +6,4 @@ object <caret>O {
var foo: String = "foo"
}
// FIR_COMPARISON
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
package server
@@ -1,7 +1,8 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtPrimaryConstructor
// OPTIONS: usages
// FIR_COMPARISON
class <caret>() {
}
}
// FIR_IGNORE
@@ -14,3 +14,5 @@ open class B: A<String>("") {
println("set:" + value)
}
}
// FIR_IGNORE
@@ -14,3 +14,5 @@ open class B: A<String>("") {
println("set:" + value)
}
}
// FIR_IGNORE
@@ -14,3 +14,5 @@ open class B: A<String>("") {
println("set:" + value)
}
}
// FIR_IGNORE
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
fun foo(): String {
val <caret>bar = ""
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
fun foo(): String {
if (true) {
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
class Outer {
val x = Outer.t
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
// FIR_COMPARISON
class P
@@ -26,4 +26,6 @@ class C : B() {
fun test() {
B()
}
}
// FIR_IGNORE

Some files were not shown because too many files have changed in this diff Show More