[Analysis API FIR] implement reference resolve inside KDoc
^KTIJ-22324 fixed
This commit is contained in:
+6
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.*
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeToken
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||
import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies
|
||||
import org.jetbrains.kotlin.descriptors.isEmpty
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -127,6 +128,11 @@ internal class KtFe10SymbolProvider(
|
||||
.mapNotNull { it.toKtSymbol(analysisContext) as? KtCallableSymbol }
|
||||
}
|
||||
|
||||
override fun getPackageSymbolIfPackageExists(packageFqName: FqName): KtPackageSymbol? {
|
||||
if (analysisContext.resolveSession.packageFragmentProvider.isEmpty(packageFqName)) return null
|
||||
return KtFe10PackageSymbol(packageFqName, analysisContext)
|
||||
}
|
||||
|
||||
override fun getDestructuringDeclarationEntrySymbol(psi: KtDestructuringDeclarationEntry): KtLocalVariableSymbol {
|
||||
return KtFe10PsiLocalVariableSymbol(psi, analysisContext)
|
||||
}
|
||||
|
||||
+246
@@ -1040,6 +1040,252 @@ public class Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exte
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class KDoc {
|
||||
@Test
|
||||
public void testAllFilesPresentInKDoc() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/localContext")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class LocalContext {
|
||||
@Test
|
||||
public void testAllFilesPresentInLocalContext() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/localContext"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedCallableName.kt")
|
||||
public void testLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedClassName.kt")
|
||||
public void testLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedCallableName.kt")
|
||||
public void testNonLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedClassName.kt")
|
||||
public void testNonLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalMethod.kt")
|
||||
public void testSelfLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalProperty.kt")
|
||||
public void testSelfLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalProperty.kt")
|
||||
public void testSelfNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalMethod.kt")
|
||||
public void testSiblingLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalProperty.kt")
|
||||
public void testSiblingLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingNonLocalProperty.kt")
|
||||
public void testSiblingNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingNonLocalProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/parameters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Parameters {
|
||||
@Test
|
||||
public void testAllFilesPresentInParameters() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/parameters"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorParameter.kt")
|
||||
public void testClassPrimaryConstructorParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorValParameter.kt")
|
||||
public void testClassPrimaryConstructorValParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorValParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassTypeParameter.kt")
|
||||
public void testClassTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstructorValueParameter.kt")
|
||||
public void testConstructorValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ConstructorValueParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionTypeParameter.kt")
|
||||
public void testFunctionTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionValueParameter.kt")
|
||||
public void testFunctionValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionValueParameter.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Qualified {
|
||||
@Test
|
||||
public void testAllFilesPresentInQualified() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FromOtherFile {
|
||||
@Test
|
||||
public void testAllFilesPresentInFromOtherFile() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherByShortName.kt")
|
||||
public void testEnumEntryFromOtherByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherFileByFullName.kt")
|
||||
public void testEnumEntryFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByFullName.kt")
|
||||
public void testNestedClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByShortName.kt")
|
||||
public void testNestedClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByFullName.kt")
|
||||
public void testTopLevelClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByShortName.kt")
|
||||
public void testTopLevelClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromOtherFileByFullName.kt")
|
||||
public void testTopLevelFunctionFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Stdlib {
|
||||
@Test
|
||||
public void testAllFilesPresentInStdlib() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByFullName.kt")
|
||||
public void testEnumEntryFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByShortName.kt")
|
||||
public void testEnumEntryFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByFullName.kt")
|
||||
public void testTopLevelClassFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByShortName.kt")
|
||||
public void testTopLevelClassFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByFullName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/nestedTypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+3
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtMainModu
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
@@ -28,6 +29,8 @@ import kotlin.io.path.nameWithoutExtension
|
||||
object AnalysisApiFe10TestConfigurator : AnalysisApiTestConfigurator() {
|
||||
override val analyseInDependentSession: Boolean get() = false
|
||||
|
||||
override val frontendKind: FrontendKind get() = FrontendKind.Fe10
|
||||
|
||||
override val testPrefix: String
|
||||
get() = "descriptors"
|
||||
|
||||
|
||||
@@ -90,3 +90,7 @@ val generateCode by tasks.registering(NoDebugJavaExec::class) {
|
||||
val compileKotlin by tasks
|
||||
|
||||
compileKotlin.dependsOn(generateCode)
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions.freeCompilerArgs += "-Xcontext-receivers"
|
||||
}
|
||||
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.references
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithMembers
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
|
||||
internal object KDocReferenceResolver {
|
||||
|
||||
context(KtAnalysisSession)
|
||||
internal fun resolveKdocFqName(fqName: FqName, owner: KtDeclaration?): Collection<KtSymbol> = buildSet {
|
||||
collectSymbolsByFullyQualifiedName(fqName)
|
||||
|
||||
if (owner != null) {
|
||||
collectSymbolsFromPositionScopes(owner, fqName)
|
||||
val ownerSymbol = owner.getSymbol()
|
||||
|
||||
val pathSegments = fqName.pathSegments()
|
||||
if (pathSegments.size == 1) {
|
||||
val singleSegment = pathSegments.single()
|
||||
when {
|
||||
owner is KtConstructorSymbol -> {
|
||||
collectConstructorParameterSymbols(owner, singleSegment)
|
||||
}
|
||||
|
||||
ownerSymbol is KtNamedClassOrObjectSymbol -> {
|
||||
collectPrimaryConstructorParameterSymbols(ownerSymbol, singleSegment)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
private fun MutableCollection<KtSymbol>.collectPrimaryConstructorParameterSymbols(owner: KtNamedClassOrObjectSymbol, name: Name) {
|
||||
val primaryConstructor = owner.getDeclaredMemberScope().getConstructors().firstOrNull { it.isPrimary } ?: return
|
||||
collectConstructorParameterSymbols(primaryConstructor, name)
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
private fun MutableCollection<KtSymbol>.collectSymbolsFromPositionScopes(owner: KtDeclaration, fqName: FqName) {
|
||||
val initialScope = owner.containingKtFile.getScopeContextForPosition(owner).scopes
|
||||
|
||||
val scope = fqName.pathSegments()
|
||||
.dropLast(1)
|
||||
.fold(initialScope) { currentScope, fqNamePart ->
|
||||
currentScope
|
||||
.getClassifierSymbols { it == fqNamePart }
|
||||
.mapNotNull { (it as? KtSymbolWithMembers)?.getDeclaredMemberScope() }
|
||||
.toList()
|
||||
.asCompositeScope()
|
||||
}
|
||||
|
||||
val shortName = fqName.shortName()
|
||||
addAll(scope.getCallableSymbols { it == shortName })
|
||||
addAll(scope.getClassifierSymbols { it == shortName })
|
||||
}
|
||||
|
||||
context(KtAnalysisSession, MutableCollection<KtSymbol>)
|
||||
private fun collectConstructorParameterSymbols(owner: KtFunctionLikeSymbol, name: Name) {
|
||||
for (valueParameter in owner.valueParameters) {
|
||||
if (valueParameter.name == name) {
|
||||
add(valueParameter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
private fun MutableCollection<KtSymbol>.collectSymbolsByFullyQualifiedName(fqName: FqName) {
|
||||
generateNameInterpretations(fqName).forEach { interpretation ->
|
||||
collectSymbolsByFqNameInterpretation(interpretation)
|
||||
}
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
private fun MutableCollection<KtSymbol>.collectSymbolsByFqNameInterpretation(
|
||||
interpretation: FqNameInterpretation,
|
||||
) {
|
||||
when (interpretation) {
|
||||
is FqNameInterpretation.FqNameInterpretationAsCallableId -> {
|
||||
collectSymbolsByFqNameInterpretationAsCallableId(interpretation.callableId)
|
||||
}
|
||||
|
||||
is FqNameInterpretation.FqNameInterpretationAsClassId -> {
|
||||
collectSymbolsByClassId(interpretation.classId)
|
||||
}
|
||||
|
||||
is FqNameInterpretation.FqNameInterpretationAsPackage -> {
|
||||
collectSymbolsByPackage(interpretation.packageFqName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
private fun MutableCollection<KtSymbol>.collectSymbolsByPackage(packageFqName: FqName) {
|
||||
getPackageSymbolIfPackageExists(packageFqName)?.let(::add)
|
||||
}
|
||||
|
||||
context(KtAnalysisSession, MutableCollection<KtSymbol>)
|
||||
private fun collectSymbolsByClassId(classId: ClassId) {
|
||||
classId.getCorrespondingToplevelClassOrObjectSymbol()?.let(::add)
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
private fun MutableCollection<KtSymbol>.collectSymbolsByFqNameInterpretationAsCallableId(callableId: CallableId) {
|
||||
when (val classId = callableId.classId) {
|
||||
null -> {
|
||||
addAll(callableId.packageName.getContainingCallableSymbolsWithName(callableId.callableName))
|
||||
}
|
||||
|
||||
else -> {
|
||||
classId.getCorrespondingToplevelClassOrObjectSymbol()
|
||||
?.getDeclaredMemberScope()
|
||||
?.getCallableSymbols { it == callableId.callableName }
|
||||
?.let(::addAll)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun generateNameInterpretations(fqName: FqName): Sequence<FqNameInterpretation> = sequence {
|
||||
val parts = fqName.pathSegments()
|
||||
if (parts.isEmpty()) {
|
||||
yield(FqNameInterpretation.create(packageParts = emptyList(), classParts = emptyList(), callable = null))
|
||||
return@sequence
|
||||
}
|
||||
for (lastPackagePartIndexExclusive in 0..parts.size) {
|
||||
yield(
|
||||
FqNameInterpretation.create(
|
||||
packageParts = parts.subList(0, lastPackagePartIndexExclusive),
|
||||
classParts = parts.subList(lastPackagePartIndexExclusive, parts.size),
|
||||
callable = null,
|
||||
)
|
||||
)
|
||||
|
||||
if (lastPackagePartIndexExclusive <= parts.size - 1) {
|
||||
yield(
|
||||
FqNameInterpretation.create(
|
||||
packageParts = parts.subList(0, lastPackagePartIndexExclusive),
|
||||
classParts = parts.subList(lastPackagePartIndexExclusive, parts.size - 1),
|
||||
callable = parts.last(),
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class FqNameInterpretation {
|
||||
|
||||
data class FqNameInterpretationAsPackage(val packageFqName: FqName) : FqNameInterpretation()
|
||||
data class FqNameInterpretationAsClassId(val classId: ClassId) : FqNameInterpretation()
|
||||
data class FqNameInterpretationAsCallableId(val callableId: CallableId) : FqNameInterpretation()
|
||||
|
||||
companion object {
|
||||
fun create(packageParts: List<Name>, classParts: List<Name>, callable: Name?): FqNameInterpretation {
|
||||
val packageName = FqName.fromSegments(packageParts.map { it.asString() })
|
||||
val relativeClassName = FqName.fromSegments(classParts.map { it.asString() })
|
||||
|
||||
return when {
|
||||
classParts.isEmpty() && callable == null -> FqNameInterpretationAsPackage(packageName)
|
||||
callable == null -> FqNameInterpretationAsClassId(ClassId(packageName, relativeClassName, false))
|
||||
else -> FqNameInterpretationAsCallableId(CallableId(packageName, relativeClassName.takeUnless { it.isRoot }, callable))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.references
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.fir.references.KtFirKDocReference
|
||||
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
||||
import org.jetbrains.kotlin.resolve.references.ReferenceAccess
|
||||
|
||||
@@ -18,6 +19,7 @@ class KotlinFirReferenceContributor : KotlinReferenceProviderContributor {
|
||||
registerProvider(factory = ::KtFirArrayAccessReference)
|
||||
registerProvider(factory = ::KtFirConstructorDelegationReference)
|
||||
registerProvider(factory = ::KtFirCollectionLiteralReference)
|
||||
registerProvider(factory = ::KtFirKDocReference)
|
||||
|
||||
registerMultiProvider<KtSimpleNameExpression> { nameReferenceExpression ->
|
||||
when (nameReferenceExpression.readWriteAccess(useResolveForReadWrite = true)) {
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.references
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.fir.KtFirAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.parentOfType
|
||||
import org.jetbrains.kotlin.idea.references.KDocReference
|
||||
import org.jetbrains.kotlin.idea.references.KtFirReference
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocName
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
|
||||
|
||||
internal class KtFirKDocReference(element: KDocName) : KDocReference(element), KtFirReference {
|
||||
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
|
||||
val owner = element.parentOfType<KtDeclaration>()
|
||||
return KDocReferenceResolver.resolveKdocFqName(element.getQualifiedNameAsFqName(), owner)
|
||||
}
|
||||
}
|
||||
+4
@@ -169,6 +169,10 @@ internal class KtFirSymbolProvider(
|
||||
return firs.asSequence().map { firSymbol -> firSymbolBuilder.buildSymbol(firSymbol) }
|
||||
}
|
||||
|
||||
override fun getPackageSymbolIfPackageExists(packageFqName: FqName): KtPackageSymbol? {
|
||||
return firSymbolBuilder.createPackageSymbolIfOneExists(packageFqName)
|
||||
}
|
||||
|
||||
override val ROOT_PACKAGE_SYMBOL: KtPackageSymbol = KtFirPackageSymbol(FqName.ROOT, firResolveSession.project, token)
|
||||
|
||||
override fun getDestructuringDeclarationEntrySymbol(psi: KtDestructuringDeclarationEntry): KtLocalVariableSymbol {
|
||||
|
||||
+246
@@ -1040,6 +1040,252 @@ public class FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated ex
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class KDoc {
|
||||
@Test
|
||||
public void testAllFilesPresentInKDoc() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/localContext")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class LocalContext {
|
||||
@Test
|
||||
public void testAllFilesPresentInLocalContext() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/localContext"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedCallableName.kt")
|
||||
public void testLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedClassName.kt")
|
||||
public void testLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedCallableName.kt")
|
||||
public void testNonLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedClassName.kt")
|
||||
public void testNonLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalMethod.kt")
|
||||
public void testSelfLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalProperty.kt")
|
||||
public void testSelfLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalProperty.kt")
|
||||
public void testSelfNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalMethod.kt")
|
||||
public void testSiblingLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalProperty.kt")
|
||||
public void testSiblingLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingNonLocalProperty.kt")
|
||||
public void testSiblingNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingNonLocalProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/parameters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Parameters {
|
||||
@Test
|
||||
public void testAllFilesPresentInParameters() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/parameters"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorParameter.kt")
|
||||
public void testClassPrimaryConstructorParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorValParameter.kt")
|
||||
public void testClassPrimaryConstructorValParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorValParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassTypeParameter.kt")
|
||||
public void testClassTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstructorValueParameter.kt")
|
||||
public void testConstructorValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ConstructorValueParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionTypeParameter.kt")
|
||||
public void testFunctionTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionValueParameter.kt")
|
||||
public void testFunctionValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionValueParameter.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Qualified {
|
||||
@Test
|
||||
public void testAllFilesPresentInQualified() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FromOtherFile {
|
||||
@Test
|
||||
public void testAllFilesPresentInFromOtherFile() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherByShortName.kt")
|
||||
public void testEnumEntryFromOtherByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherFileByFullName.kt")
|
||||
public void testEnumEntryFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByFullName.kt")
|
||||
public void testNestedClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByShortName.kt")
|
||||
public void testNestedClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByFullName.kt")
|
||||
public void testTopLevelClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByShortName.kt")
|
||||
public void testTopLevelClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromOtherFileByFullName.kt")
|
||||
public void testTopLevelFunctionFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Stdlib {
|
||||
@Test
|
||||
public void testAllFilesPresentInStdlib() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByFullName.kt")
|
||||
public void testEnumEntryFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByShortName.kt")
|
||||
public void testEnumEntryFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByFullName.kt")
|
||||
public void testTopLevelClassFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByShortName.kt")
|
||||
public void testTopLevelClassFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByFullName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/nestedTypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+246
@@ -930,6 +930,252 @@ public class FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerate
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class KDoc {
|
||||
@Test
|
||||
public void testAllFilesPresentInKDoc() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "withErrors");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/localContext")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class LocalContext {
|
||||
@Test
|
||||
public void testAllFilesPresentInLocalContext() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/localContext"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "withErrors");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedCallableName.kt")
|
||||
public void testLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedClassName.kt")
|
||||
public void testLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedCallableName.kt")
|
||||
public void testNonLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedClassName.kt")
|
||||
public void testNonLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalMethod.kt")
|
||||
public void testSelfLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalProperty.kt")
|
||||
public void testSelfLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalProperty.kt")
|
||||
public void testSelfNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalMethod.kt")
|
||||
public void testSiblingLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalProperty.kt")
|
||||
public void testSiblingLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingNonLocalProperty.kt")
|
||||
public void testSiblingNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingNonLocalProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/parameters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Parameters {
|
||||
@Test
|
||||
public void testAllFilesPresentInParameters() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/parameters"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "withErrors");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorParameter.kt")
|
||||
public void testClassPrimaryConstructorParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorValParameter.kt")
|
||||
public void testClassPrimaryConstructorValParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorValParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassTypeParameter.kt")
|
||||
public void testClassTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstructorValueParameter.kt")
|
||||
public void testConstructorValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ConstructorValueParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionTypeParameter.kt")
|
||||
public void testFunctionTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionValueParameter.kt")
|
||||
public void testFunctionValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionValueParameter.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Qualified {
|
||||
@Test
|
||||
public void testAllFilesPresentInQualified() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "withErrors");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FromOtherFile {
|
||||
@Test
|
||||
public void testAllFilesPresentInFromOtherFile() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "withErrors");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherByShortName.kt")
|
||||
public void testEnumEntryFromOtherByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherFileByFullName.kt")
|
||||
public void testEnumEntryFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByFullName.kt")
|
||||
public void testNestedClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByShortName.kt")
|
||||
public void testNestedClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByFullName.kt")
|
||||
public void testTopLevelClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByShortName.kt")
|
||||
public void testTopLevelClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromOtherFileByFullName.kt")
|
||||
public void testTopLevelFunctionFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Stdlib {
|
||||
@Test
|
||||
public void testAllFilesPresentInStdlib() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "withErrors");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByFullName.kt")
|
||||
public void testEnumEntryFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByShortName.kt")
|
||||
public void testEnumEntryFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByFullName.kt")
|
||||
public void testTopLevelClassFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByShortName.kt")
|
||||
public void testTopLevelClassFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByFullName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/nestedTypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+246
@@ -1040,6 +1040,252 @@ public class FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exten
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class KDoc {
|
||||
@Test
|
||||
public void testAllFilesPresentInKDoc() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/localContext")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class LocalContext {
|
||||
@Test
|
||||
public void testAllFilesPresentInLocalContext() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/localContext"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedCallableName.kt")
|
||||
public void testLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedClassName.kt")
|
||||
public void testLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedCallableName.kt")
|
||||
public void testNonLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedClassName.kt")
|
||||
public void testNonLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalMethod.kt")
|
||||
public void testSelfLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalProperty.kt")
|
||||
public void testSelfLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalProperty.kt")
|
||||
public void testSelfNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalMethod.kt")
|
||||
public void testSiblingLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalProperty.kt")
|
||||
public void testSiblingLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingNonLocalProperty.kt")
|
||||
public void testSiblingNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingNonLocalProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/parameters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Parameters {
|
||||
@Test
|
||||
public void testAllFilesPresentInParameters() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/parameters"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorParameter.kt")
|
||||
public void testClassPrimaryConstructorParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorValParameter.kt")
|
||||
public void testClassPrimaryConstructorValParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorValParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassTypeParameter.kt")
|
||||
public void testClassTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstructorValueParameter.kt")
|
||||
public void testConstructorValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ConstructorValueParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionTypeParameter.kt")
|
||||
public void testFunctionTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionValueParameter.kt")
|
||||
public void testFunctionValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionValueParameter.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Qualified {
|
||||
@Test
|
||||
public void testAllFilesPresentInQualified() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FromOtherFile {
|
||||
@Test
|
||||
public void testAllFilesPresentInFromOtherFile() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherByShortName.kt")
|
||||
public void testEnumEntryFromOtherByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherFileByFullName.kt")
|
||||
public void testEnumEntryFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByFullName.kt")
|
||||
public void testNestedClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByShortName.kt")
|
||||
public void testNestedClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByFullName.kt")
|
||||
public void testTopLevelClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByShortName.kt")
|
||||
public void testTopLevelClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromOtherFileByFullName.kt")
|
||||
public void testTopLevelFunctionFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Stdlib {
|
||||
@Test
|
||||
public void testAllFilesPresentInStdlib() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByFullName.kt")
|
||||
public void testEnumEntryFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByShortName.kt")
|
||||
public void testEnumEntryFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByFullName.kt")
|
||||
public void testTopLevelClassFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByShortName.kt")
|
||||
public void testTopLevelClassFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByFullName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/nestedTypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+2
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModule
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.libraries.compiledLibraryProvider
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
@@ -28,6 +29,7 @@ import org.jetbrains.kotlin.test.services.TestServices
|
||||
|
||||
object AnalysisApiFirLibraryBinaryTestConfigurator : AnalysisApiTestConfigurator() {
|
||||
override val analyseInDependentSession: Boolean get() = false
|
||||
override val frontendKind: FrontendKind get() = FrontendKind.Fir
|
||||
|
||||
override fun configureTest(
|
||||
builder: TestConfigurationBuilder,
|
||||
|
||||
+2
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.analysis.test.framework.services.libraries.CompiledL
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.libraries.compiledLibraryProvider
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
@@ -32,6 +33,7 @@ import org.jetbrains.kotlin.test.services.TestServices
|
||||
|
||||
object AnalysisApiFirLibrarySourceTestConfigurator : AnalysisApiTestConfigurator() {
|
||||
override val analyseInDependentSession: Boolean get() = false
|
||||
override val frontendKind: FrontendKind get() = FrontendKind.Fir
|
||||
|
||||
override fun configureTest(
|
||||
builder: TestConfigurationBuilder,
|
||||
|
||||
+8
-1
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.analysis.api.components.KtDeclarationRendererOptions
|
||||
import org.jetbrains.kotlin.analysis.api.components.RendererModifier
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references.TestReferenceResolveResultRenderer.renderResolvedTo
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||
import org.jetbrains.kotlin.analysis.test.framework.AnalysisApiTestDirectives
|
||||
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedSingleModuleTest
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.expressionMarkerProvider
|
||||
import org.jetbrains.kotlin.analysis.test.framework.utils.unwrapMultiReferences
|
||||
@@ -30,11 +31,17 @@ abstract class AbstractReferenceResolveTest : AbstractAnalysisApiBasedSingleModu
|
||||
+ConfigurationDirectives.WITH_STDLIB
|
||||
}
|
||||
useDirectives(Directives)
|
||||
forTestsMatching("analysis/analysis-api/testData/referenceResolve/kDoc/*") {
|
||||
defaultDirectives {
|
||||
+AnalysisApiTestDirectives.DISABLE_DEPENDED_MODE
|
||||
+AnalysisApiTestDirectives.IGNORE_FE10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun doTestByFileStructure(ktFiles: List<KtFile>, module: TestModule, testServices: TestServices) {
|
||||
val mainKtFile = ktFiles.singleOrNull() ?: ktFiles.first { it.name == "main.kt" }
|
||||
val mainKtFile = ktFiles.singleOrNull() ?: ktFiles.firstOrNull { it.name == "main.kt" } ?: ktFiles.first()
|
||||
val caretPosition = testServices.expressionMarkerProvider.getCaretPosition(mainKtFile)
|
||||
val ktReferences = findReferencesAtCaret(mainKtFile, caretPosition)
|
||||
if (ktReferences.isEmpty()) {
|
||||
|
||||
+246
@@ -1040,6 +1040,252 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerate
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class KDoc {
|
||||
@Test
|
||||
public void testAllFilesPresentInKDoc() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/localContext")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class LocalContext {
|
||||
@Test
|
||||
public void testAllFilesPresentInLocalContext() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/localContext"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedCallableName.kt")
|
||||
public void testLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalSemiFullQualifiedClassName.kt")
|
||||
public void testLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedCallableName.kt")
|
||||
public void testNonLocalSemiFullQualifiedCallableName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedCallableName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NonLocalSemiFullQualifiedClassName.kt")
|
||||
public void testNonLocalSemiFullQualifiedClassName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/NonLocalSemiFullQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalMethod.kt")
|
||||
public void testSelfLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfLocalProperty.kt")
|
||||
public void testSelfLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalProperty.kt")
|
||||
public void testSelfNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalMethod.kt")
|
||||
public void testSiblingLocalMethod() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingLocalProperty.kt")
|
||||
public void testSiblingLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SiblingNonLocalProperty.kt")
|
||||
public void testSiblingNonLocalProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SiblingNonLocalProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/parameters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Parameters {
|
||||
@Test
|
||||
public void testAllFilesPresentInParameters() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/parameters"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorParameter.kt")
|
||||
public void testClassPrimaryConstructorParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassPrimaryConstructorValParameter.kt")
|
||||
public void testClassPrimaryConstructorValParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorValParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassTypeParameter.kt")
|
||||
public void testClassTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstructorValueParameter.kt")
|
||||
public void testConstructorValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ConstructorValueParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionTypeParameter.kt")
|
||||
public void testFunctionTypeParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunctionValueParameter.kt")
|
||||
public void testFunctionValueParameter() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/parameters/FunctionValueParameter.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Qualified {
|
||||
@Test
|
||||
public void testAllFilesPresentInQualified() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FromOtherFile {
|
||||
@Test
|
||||
public void testAllFilesPresentInFromOtherFile() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherByShortName.kt")
|
||||
public void testEnumEntryFromOtherByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromOtherFileByFullName.kt")
|
||||
public void testEnumEntryFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/EnumEntryFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByFullName.kt")
|
||||
public void testNestedClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClassFromOtherFileByShortName.kt")
|
||||
public void testNestedClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/NestedClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByFullName.kt")
|
||||
public void testTopLevelClassFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromOtherFileByShortName.kt")
|
||||
public void testTopLevelClassFromOtherFileByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelClassFromOtherFileByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromOtherFileByFullName.kt")
|
||||
public void testTopLevelFunctionFromOtherFileByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromOtherFileByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/fromOtherFile/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Stdlib {
|
||||
@Test
|
||||
public void testAllFilesPresentInStdlib() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByFullName.kt")
|
||||
public void testEnumEntryFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryFromStdlibByShortName.kt")
|
||||
public void testEnumEntryFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/EnumEntryFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByFullName.kt")
|
||||
public void testTopLevelClassFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelClassFromStdlibByShortName.kt")
|
||||
public void testTopLevelClassFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelClassFromStdlibByShortName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByFullName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByFullName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByFullName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelFunctionFromStdlibByShortName.kt")
|
||||
public void testTopLevelFunctionFromStdlibByShortName() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/qualified/stdlib/TopLevelFunctionFromStdlibByShortName.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/referenceResolve/nestedTypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+2
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtMod
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.services.TestModuleStructure
|
||||
@@ -18,6 +19,7 @@ import org.jetbrains.kotlin.test.services.TestServices
|
||||
|
||||
object StandaloneModeConfigurator : AnalysisApiTestConfigurator() {
|
||||
override val analyseInDependentSession: Boolean get() = false
|
||||
override val frontendKind: FrontendKind get() = FrontendKind.Fir
|
||||
|
||||
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
|
||||
AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false).configureTest(builder, disposable)
|
||||
|
||||
+9
@@ -51,6 +51,8 @@ public abstract class KtSymbolProvider : KtAnalysisSessionComponent() {
|
||||
public abstract fun getClassInitializerSymbol(psi: KtClassInitializer): KtClassInitializerSymbol
|
||||
public abstract fun getDestructuringDeclarationEntrySymbol(psi: KtDestructuringDeclarationEntry): KtLocalVariableSymbol
|
||||
|
||||
public abstract fun getPackageSymbolIfPackageExists(packageFqName: FqName): KtPackageSymbol?
|
||||
|
||||
public abstract fun getClassOrObjectSymbolByClassId(classId: ClassId): KtClassOrObjectSymbol?
|
||||
|
||||
public abstract fun getTopLevelCallableSymbols(packageFqName: FqName, name: Name): Sequence<KtSymbol>
|
||||
@@ -126,6 +128,13 @@ public interface KtSymbolProviderMixIn : KtAnalysisSessionMixIn {
|
||||
public fun KtFile.getFileSymbol(): KtFileSymbol =
|
||||
withValidityAssertion { analysisSession.symbolProvider.getFileSymbol(this) }
|
||||
|
||||
/**
|
||||
* Returns [KtPackageSymbol] corresponding to [packageFqName] if corresponding package is exists and visible from current uses-site scope,
|
||||
* `null` otherwise
|
||||
*/
|
||||
public fun getPackageSymbolIfPackageExists(packageFqName: FqName): KtPackageSymbol? =
|
||||
withValidityAssertion { analysisSession.symbolProvider.getPackageSymbolIfPackageExists(packageFqName) }
|
||||
|
||||
/**
|
||||
* @return symbol with specified [this@getClassOrObjectSymbolByClassId] or `null` in case such symbol is not found
|
||||
*/
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
class C {
|
||||
class X {
|
||||
class YY {
|
||||
fun aa() {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [X.YY.a<caret>a]
|
||||
*/
|
||||
fun g() {
|
||||
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in C.X.YY) fun aa()
|
||||
analysis/analysis-api/testData/referenceResolve/kDoc/localContext/LocalSemiFullQualifiedClassName.kt
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// COMPILATION_ERRORS
|
||||
fun f() {
|
||||
class C {
|
||||
class X {
|
||||
class YY {
|
||||
fun aa() {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [X.Y<caret>Y]
|
||||
*/
|
||||
fun g() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in <local>: f.C.X) class YY
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// COMPILATION_ERRORS
|
||||
fun f() {
|
||||
class C {
|
||||
class X {
|
||||
class YY {
|
||||
fun aa() {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [X.YY.a<caret>a]
|
||||
*/
|
||||
fun g() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in <local>: f.C.X.YY) fun aa()
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
class C {
|
||||
class X {
|
||||
class YY {
|
||||
fun aa() {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [X.Y<caret>Y]
|
||||
*/
|
||||
fun g() {
|
||||
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in C.X) class YY
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun f() {
|
||||
class C {
|
||||
/**
|
||||
* [a<caret>a]
|
||||
*/
|
||||
fun aa() {}
|
||||
|
||||
fun bb() {}
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in <local>: f.C) fun aa()
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun f() {
|
||||
class C {
|
||||
/**
|
||||
* [a<caret>a]
|
||||
*/
|
||||
val aa: Int = 1
|
||||
|
||||
val bb: Int = 10
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in <local>: f.C) val aa: kotlin.Int
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class C {
|
||||
/**
|
||||
* [a<caret>a]
|
||||
*/
|
||||
fun aa(){}
|
||||
|
||||
fun bb(){}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in C) fun aa()
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class C {
|
||||
/**
|
||||
* [a<caret>a]
|
||||
*/
|
||||
val aa: Int = 1
|
||||
|
||||
val bb: Int = 10
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in C) val aa: kotlin.Int
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun f() {
|
||||
class C {
|
||||
/**
|
||||
* [b<caret>b]
|
||||
*/
|
||||
fun aa() {}
|
||||
|
||||
fun bb() {}
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in <local>: f.C) fun bb()
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun f() {
|
||||
class C {
|
||||
/**
|
||||
* [b<caret>b]
|
||||
*/
|
||||
fun aa() {}
|
||||
|
||||
val bb: Int = 10
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in <local>: f.C) val bb: kotlin.Int
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
class C {
|
||||
/**
|
||||
* [b<caret>b]
|
||||
*/
|
||||
fun aa(){}
|
||||
|
||||
val bb: Int = 10
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in C) val bb: kotlin.Int
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* [a<caret>a]
|
||||
*/
|
||||
class C(aa: Int)
|
||||
analysis/analysis-api/testData/referenceResolve/kDoc/parameters/ClassPrimaryConstructorParameter.txt
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: aa: kotlin.Int
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* [a<caret>a]
|
||||
*/
|
||||
class C(val aa: Int)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Resolved to:
|
||||
0: (in C) val aa: kotlin.Int
|
||||
1: aa: kotlin.Int
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* [A<caret>A]
|
||||
*/
|
||||
class C<AA>()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: AA
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// TODO
|
||||
// UNRESOLVED_REFERENCE
|
||||
|
||||
|
||||
class C {
|
||||
/**
|
||||
* [a<caret>a]
|
||||
*/
|
||||
constructor(aa: Int){}
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: aa: kotlin.Int
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* [A<caret>A]
|
||||
*/
|
||||
fun <AA> x() {
|
||||
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: AA
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* [a<caret>a]
|
||||
*/
|
||||
fun x(aa: Int) {
|
||||
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: aa: kotlin.Int
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: a.kt
|
||||
|
||||
import b.*
|
||||
|
||||
/**
|
||||
* [E.A<caret>A]
|
||||
*/
|
||||
fun x() {}
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
enum class E {
|
||||
AA, BB
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in b.E) AA
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// FILE: a.kt
|
||||
/**
|
||||
* [b.E.A<caret>A]
|
||||
*/
|
||||
fun x() {}
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
enum class E {
|
||||
AA, BB
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in b.E) AA
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// FILE: a.kt
|
||||
/**
|
||||
* [b.B.X<caret>X]
|
||||
*/
|
||||
fun x() {}
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
class B {
|
||||
class XX
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in b.B) class XX
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: a.kt
|
||||
|
||||
import b.*
|
||||
|
||||
/**
|
||||
* [B.X<caret>X]
|
||||
*/
|
||||
fun x() {}
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
class B {
|
||||
class XX
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in b.B) class XX
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// FILE: a.kt
|
||||
/**
|
||||
* [b.B<caret>B]
|
||||
*/
|
||||
fun x() {}
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
class BB {
|
||||
class XX
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in b) class BB
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// FILE: a.kt
|
||||
import b.*
|
||||
|
||||
/**
|
||||
* [B<caret>B]
|
||||
*/
|
||||
fun x() {}
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
class BB {
|
||||
class XX
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in b) class BB
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// FILE: a.kt
|
||||
/**
|
||||
* [b.b<caret>b]
|
||||
*/
|
||||
fun x() {}
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
fun bb(){}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in b) fun bb()
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// FILE: a.kt
|
||||
import b.*
|
||||
/**
|
||||
* [b<caret>b]
|
||||
*/
|
||||
fun x() {}
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
fun bb(){}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in b) fun bb()
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* [kotlin.LazyThreadSafetyMode.PUB<caret>LICATION]
|
||||
*/
|
||||
fun x() {}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in kotlin.LazyThreadSafetyMode) PUBLICATION
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import kotlin.LazyThreadSafetyMode
|
||||
|
||||
/**
|
||||
* [LazyThreadSafetyMode.PUB<caret>LICATION]
|
||||
*/
|
||||
fun x() {}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in kotlin.LazyThreadSafetyMode) PUBLICATION
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* [kotlin.collections.Abstr<caret>actCollection]
|
||||
*/
|
||||
fun x() {}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in kotlin.collections) abstract class AbstractCollection<out E> : kotlin.collections.Collection<E>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import kotlin.collections.AbstractCollection
|
||||
|
||||
/**
|
||||
* [Abstr<caret>actCollection]
|
||||
*/
|
||||
fun x() {}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in kotlin.collections) abstract class AbstractCollection<out E> : kotlin.collections.Collection<E>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* [kotlin.collections.listO<caret>f]
|
||||
*/
|
||||
fun x() {}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
Resolved to:
|
||||
0: (in kotlin.collections) fun <T> listOf(element: T): kotlin.collections.List<T>
|
||||
1: (in kotlin.collections) fun <T> listOf(vararg elements: T): kotlin.collections.List<T>
|
||||
2: (in kotlin.collections) inline fun <T> listOf(): kotlin.collections.List<T>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import kotlin.collections.listOf
|
||||
|
||||
/**
|
||||
* [listO<caret>f]
|
||||
*/
|
||||
fun x() {}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
Resolved to:
|
||||
0: (in kotlin.collections) fun <T> listOf(element: T): kotlin.collections.List<T>
|
||||
1: (in kotlin.collections) fun <T> listOf(vararg elements: T): kotlin.collections.List<T>
|
||||
2: (in kotlin.collections) inline fun <T> listOf(): kotlin.collections.List<T>
|
||||
+1
@@ -9,4 +9,5 @@ import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
|
||||
|
||||
object AnalysisApiTestDirectives : SimpleDirectivesContainer() {
|
||||
val DISABLE_DEPENDED_MODE by directive("Analysis in dependent mode should not be run in this test")
|
||||
val IGNORE_FE10 by directive("FE10 Analysis API implementation test should mot be run")
|
||||
}
|
||||
+11
@@ -18,7 +18,9 @@ import org.jetbrains.kotlin.analysis.test.framework.project.structure.ktModulePr
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.ExpressionMarkerProvider
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.ExpressionMarkersSourceFilePreprocessor
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.SubstitutionParser
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.libraries.CompilerExecutor
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
|
||||
import org.jetbrains.kotlin.analysis.test.framework.utils.SkipTestException
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
@@ -104,6 +106,8 @@ abstract class AbstractAnalysisApiBasedTest : TestWithDisposable() {
|
||||
|
||||
useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray())
|
||||
useDirectives(JvmEnvironmentConfigurationDirectives)
|
||||
useDirectives(CompilerExecutor.Directives)
|
||||
|
||||
|
||||
useSourcePreprocessor(::ExpressionMarkersSourceFilePreprocessor)
|
||||
useAdditionalService { ExpressionMarkerProvider() }
|
||||
@@ -131,6 +135,10 @@ abstract class AbstractAnalysisApiBasedTest : TestWithDisposable() {
|
||||
return
|
||||
}
|
||||
|
||||
if (configurator.frontendKind == FrontendKind.Fe10 && isFe10DisabledForTheTest()) {
|
||||
return
|
||||
}
|
||||
|
||||
doTestByFileStructure(moduleStructure, testServices)
|
||||
}
|
||||
|
||||
@@ -160,6 +168,9 @@ abstract class AbstractAnalysisApiBasedTest : TestWithDisposable() {
|
||||
private fun isDependentModeDisabledForTheTest(): Boolean =
|
||||
AnalysisApiTestDirectives.DISABLE_DEPENDED_MODE in testServices.moduleStructure.allDirectives
|
||||
|
||||
private fun isFe10DisabledForTheTest(): Boolean =
|
||||
AnalysisApiTestDirectives.IGNORE_FE10 in testServices.moduleStructure.allDirectives
|
||||
|
||||
protected fun <R> analyseForTest(contextElement: KtElement, action: KtAnalysisSession.() -> R): R {
|
||||
return if (configurator.analyseInDependentSession) {
|
||||
val originalContainingFile = contextElement.containingKtFile
|
||||
|
||||
+2
@@ -28,6 +28,8 @@ import kotlin.reflect.KClass
|
||||
abstract class AnalysisApiTestConfigurator {
|
||||
open val testPrefix: String? get() = null
|
||||
|
||||
abstract val frontendKind: FrontendKind
|
||||
|
||||
abstract val analyseInDependentSession: Boolean
|
||||
|
||||
abstract fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable)
|
||||
|
||||
+2
@@ -28,10 +28,12 @@ import org.jetbrains.kotlin.analysis.test.framework.base.registerAnalysisApiBase
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibraryModuleImpl
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtSourceModuleByCompilerConfiguration
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
|
||||
object FirLowLevelCompilerBasedTestConfigurator : AnalysisApiTestConfigurator() {
|
||||
override val analyseInDependentSession: Boolean get() = false
|
||||
override val frontendKind: FrontendKind get() = FrontendKind.Fir
|
||||
|
||||
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
|
||||
builder.apply {
|
||||
|
||||
+3
@@ -18,12 +18,15 @@ import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtMainModu
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.services.TestModuleStructure
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
|
||||
class AnalysisApiFirSourceTestConfigurator(override val analyseInDependentSession: Boolean) : AnalysisApiTestConfigurator() {
|
||||
override val frontendKind: FrontendKind get() = FrontendKind.Fir
|
||||
|
||||
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
|
||||
builder.apply {
|
||||
usePreAnalysisHandlers(::SealedClassesInheritorsCaclulatorPreAnalysisHandler)
|
||||
|
||||
+2
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.analysis.api.fir.test.configurators.library.Analysis
|
||||
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.services.TestModuleStructure
|
||||
@@ -18,6 +19,7 @@ import org.jetbrains.kotlin.test.services.TestServices
|
||||
|
||||
object AnalysisApiSymbolLightClassesDecompiledTestConfigurator : AnalysisApiTestConfigurator() {
|
||||
override val analyseInDependentSession: Boolean get() = false
|
||||
override val frontendKind: FrontendKind get() = FrontendKind.Fir
|
||||
|
||||
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
|
||||
AnalysisApiFirLibraryBinaryTestConfigurator.configureTest(builder, disposable)
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.kdoc.psi.api.KDoc
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getChildOfType
|
||||
|
||||
/**
|
||||
@@ -58,4 +59,8 @@ class KDocName(node: ASTNode) : KtElementImpl(node) {
|
||||
val nameAsList = listOf(getNameText())
|
||||
return if (qualifier != null) qualifier.getQualifiedName() + nameAsList else nameAsList
|
||||
}
|
||||
|
||||
fun getQualifiedNameAsFqName(): FqName {
|
||||
return FqName.fromSegments(getQualifiedName())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user