[Analysis API] Allow handling scopes from KtScopeContext separately
^KT-55527
This commit is contained in:
committed by
teamcity
parent
d89d774411
commit
4b7164a557
+6
-7
@@ -6,9 +6,7 @@
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.components
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtImplicitReceiver
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtScopeContext
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtScopeProvider
|
||||
import org.jetbrains.kotlin.analysis.api.components.*
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.components.base.Fe10KtAnalysisSessionComponent
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.scopes.KtFe10FileScope
|
||||
@@ -200,15 +198,16 @@ internal class KtFe10ScopeProvider(
|
||||
val elementToAnalyze = positionInFakeFile.containingNonLocalDeclaration() ?: originalFile
|
||||
val bindingContext = analysisContext.analyze(elementToAnalyze)
|
||||
|
||||
val scopeKind = KtScopeKind.LocalScope(0) // TODO
|
||||
val lexicalScope = positionInFakeFile.getResolutionScope(bindingContext)
|
||||
if (lexicalScope != null) {
|
||||
val compositeScope = KtCompositeScope(listOf(KtFe10ScopeLexical(lexicalScope, analysisContext)), token)
|
||||
return KtScopeContext(compositeScope, collectImplicitReceivers(lexicalScope), token)
|
||||
return KtScopeContext(listOf(KtScopeWithKind(compositeScope, scopeKind, token)), collectImplicitReceivers(lexicalScope), token)
|
||||
}
|
||||
|
||||
val fileScope = analysisContext.resolveSession.fileScopeProvider.getFileResolutionScope(originalFile)
|
||||
val compositeScope = KtCompositeScope(listOf(KtFe10ScopeLexical(fileScope, analysisContext)), token)
|
||||
return KtScopeContext(compositeScope, collectImplicitReceivers(fileScope), token)
|
||||
return KtScopeContext(listOf(KtScopeWithKind(compositeScope, scopeKind, token)), collectImplicitReceivers(fileScope), token)
|
||||
}
|
||||
|
||||
private inline fun <reified T : DeclarationDescriptor> getDescriptor(symbol: KtSymbol): T? {
|
||||
@@ -225,7 +224,7 @@ internal class KtFe10ScopeProvider(
|
||||
private fun collectImplicitReceivers(scope: LexicalScope): MutableList<KtImplicitReceiver> {
|
||||
val result = mutableListOf<KtImplicitReceiver>()
|
||||
|
||||
for (implicitReceiver in scope.getImplicitReceiversHierarchy()) {
|
||||
for ((index, implicitReceiver) in scope.getImplicitReceiversHierarchy().withIndex()) {
|
||||
val type = implicitReceiver.type.toKtType(analysisContext)
|
||||
val ownerDescriptor = implicitReceiver.containingDeclaration
|
||||
val owner = ownerDescriptor.toKtSymbol(analysisContext)
|
||||
@@ -235,7 +234,7 @@ internal class KtFe10ScopeProvider(
|
||||
continue
|
||||
}
|
||||
|
||||
result += KtImplicitReceiver(token, type, owner)
|
||||
result += KtImplicitReceiver(token, type, owner, index)
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
+43
-24
@@ -6,9 +6,7 @@
|
||||
package org.jetbrains.kotlin.analysis.api.fir.components
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtImplicitReceiver
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtScopeContext
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtScopeProvider
|
||||
import org.jetbrains.kotlin.analysis.api.components.*
|
||||
import org.jetbrains.kotlin.analysis.api.fir.KtFirAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.fir.KtSymbolByFirBuilder
|
||||
import org.jetbrains.kotlin.analysis.api.fir.scopes.*
|
||||
@@ -28,6 +26,7 @@ import org.jetbrains.kotlin.analysis.api.symbols.KtPackageSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithMembers
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtType
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.LLFirResolveSession
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.unexpectedElementError
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.getElementTextInContext
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
@@ -142,7 +141,7 @@ internal class KtFirScopeProvider(
|
||||
}
|
||||
|
||||
override fun getFileScope(fileSymbol: KtFileSymbol): KtScope {
|
||||
check(fileSymbol is KtFirFileSymbol) { "KtFirScopeProvider can only work with KtFirFileSymbol, but ${fileSymbol::class} was provided" }
|
||||
check(fileSymbol is KtFirFileSymbol) { "KtFirScopeProvider can only work with KtFirFileSymbol, but ${fileSymbol::class} was provided" }
|
||||
return KtFirFileScope(fileSymbol, builder)
|
||||
}
|
||||
|
||||
@@ -178,31 +177,29 @@ internal class KtFirScopeProvider(
|
||||
val towerDataContext =
|
||||
analysisSession.firResolveSession.getTowerContextProvider(originalFile).getClosestAvailableParentContext(positionInFakeFile)
|
||||
?: error("Cannot find enclosing declaration for ${positionInFakeFile.getElementTextInContext()}")
|
||||
val towerDataElementsIndexed = towerDataContext.towerDataElements.asReversed().withIndex()
|
||||
|
||||
val implicitReceivers = towerDataContext.nonLocalTowerDataElements.mapNotNull { it.implicitReceiver }.distinct()
|
||||
val implicitKtReceivers = implicitReceivers.map { receiver ->
|
||||
KtImplicitReceiver(
|
||||
token,
|
||||
builder.typeBuilder.buildKtType(receiver.type),
|
||||
builder.buildSymbol(receiver.boundSymbol.fir),
|
||||
)
|
||||
val implicitReceivers = towerDataElementsIndexed.flatMap { (index, towerDataElement) ->
|
||||
val receivers = listOfNotNull(towerDataElement.implicitReceiver) + towerDataElement.contextReceiverGroup.orEmpty()
|
||||
|
||||
receivers.map { receiver ->
|
||||
KtImplicitReceiver(
|
||||
token,
|
||||
builder.typeBuilder.buildKtType(receiver.type),
|
||||
builder.buildSymbol(receiver.boundSymbol.fir),
|
||||
index
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val implicitReceiverScopes = implicitReceivers.mapNotNull { it.implicitScope }
|
||||
val nonLocalScopes = towerDataContext.nonLocalTowerDataElements.mapNotNull { it.scope }.distinct()
|
||||
val firLocalScopes = towerDataContext.localScopes
|
||||
|
||||
val allKtScopes = buildList<KtScope> {
|
||||
implicitReceiverScopes.mapTo(this, ::convertToKtScope)
|
||||
nonLocalScopes.mapTo(this, ::convertToKtScope)
|
||||
firLocalScopes.mapTo(this, ::convertToKtScope)
|
||||
val firScopes = towerDataElementsIndexed.flatMap { (index, towerDataElement) ->
|
||||
towerDataElement.getAvailableScopes().map { IndexedValue(index, it) }
|
||||
}
|
||||
val scopes = firScopes.map { (index, firScope) ->
|
||||
KtScopeWithKind(convertToKtScope(firScope), getScopeKind(firScope, index), token)
|
||||
}
|
||||
|
||||
return KtScopeContext(
|
||||
getCompositeScope(allKtScopes.asReversed()),
|
||||
implicitKtReceivers.asReversed(),
|
||||
token
|
||||
)
|
||||
return KtScopeContext(scopes, implicitReceivers, token)
|
||||
}
|
||||
|
||||
private fun convertToKtScope(firScope: FirScope): KtScope {
|
||||
@@ -215,6 +212,28 @@ internal class KtFirScopeProvider(
|
||||
}
|
||||
}
|
||||
|
||||
private fun getScopeKind(firScope: FirScope, indexInTower: Int): KtScopeKind = when (firScope) {
|
||||
is FirNameAwareOnlyCallablesScope -> getScopeKind(firScope.delegate, indexInTower)
|
||||
is FirNameAwareOnlyClassifiersScope -> getScopeKind(firScope.delegate, indexInTower)
|
||||
|
||||
is FirLocalScope -> KtScopeKind.LocalScope(indexInTower)
|
||||
is FirTypeScope -> KtScopeKind.SimpleTypeScope(indexInTower)
|
||||
is FirTypeParameterScope -> KtScopeKind.TypeParameterScope(indexInTower)
|
||||
is FirPackageMemberScope -> KtScopeKind.PackageMemberScope(indexInTower)
|
||||
|
||||
is FirNestedClassifierScope -> KtScopeKind.StaticMemberScope(indexInTower)
|
||||
is FirNestedClassifierScopeWithSubstitution -> KtScopeKind.StaticMemberScope(indexInTower)
|
||||
is FirLazyNestedClassifierScope -> KtScopeKind.StaticMemberScope(indexInTower)
|
||||
is FirStaticScope -> KtScopeKind.StaticMemberScope(indexInTower)
|
||||
|
||||
is FirExplicitSimpleImportingScope -> KtScopeKind.ExplicitSimpleImportingScope(indexInTower)
|
||||
is FirExplicitStarImportingScope -> KtScopeKind.ExplicitStarImportingScope(indexInTower)
|
||||
is FirDefaultSimpleImportingScope -> KtScopeKind.DefaultSimpleImportingScope(indexInTower)
|
||||
is FirDefaultStarImportingScope -> KtScopeKind.DefaultStarImportingScope(indexInTower)
|
||||
|
||||
else -> unexpectedElementError("scope", firScope)
|
||||
}
|
||||
|
||||
private fun createPackageScope(fqName: FqName): KtFirPackageScope {
|
||||
return KtFirPackageScope(
|
||||
fqName,
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolKind
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithKind
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.llFirSession
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.originalDeclaration
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.parentOfType
|
||||
@@ -113,5 +114,5 @@ internal class KtFirSymbolContainingDeclarationProvider(
|
||||
when (val container = this.parentOfType<KtDeclaration>()) {
|
||||
is KtDestructuringDeclaration -> container.parentOfType()
|
||||
else -> container
|
||||
}
|
||||
}?.let { it.originalDeclaration ?: it }
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ internal object KDocReferenceResolver {
|
||||
|
||||
context(KtAnalysisSession)
|
||||
private fun MutableCollection<KtSymbol>.collectSymbolsFromPositionScopes(owner: KtDeclaration, fqName: FqName) {
|
||||
val initialScope = owner.containingKtFile.getScopeContextForPosition(owner).scopes
|
||||
val initialScope = owner.containingKtFile.getScopeContextForPosition(owner).getCompositeScope()
|
||||
|
||||
val scope = fqName.pathSegments()
|
||||
.dropLast(1)
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2010-2023 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.test.cases.generated.cases.scopes;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.fir.test.configurators.AnalysisApiFirTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.scopes.AbstractScopeContextForPositionTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirIdeDependentAnalysisSourceModuleScopeContextForPositionTestGenerated extends AbstractScopeContextForPositionTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Dependent,
|
||||
AnalysisApiMode.Ide
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInScopeContextForPosition() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("contextReceiver.kt")
|
||||
public void testContextReceiver() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/contextReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumEntry.kt")
|
||||
public void testEnumEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/enumEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("errorType.kt")
|
||||
public void testErrorType() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localTypeScope.kt")
|
||||
public void testLocalTypeScope() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/localTypeScope.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleScopeContextForPosition.kt")
|
||||
public void testSimpleScopeContextForPosition() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/simpleScopeContextForPosition.kt");
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2010-2023 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.test.cases.generated.cases.scopes;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.fir.test.configurators.AnalysisApiFirTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.scopes.AbstractScopeContextForPositionTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirIdeNormalAnalysisSourceModuleScopeContextForPositionTestGenerated extends AbstractScopeContextForPositionTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Ide
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInScopeContextForPosition() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("contextReceiver.kt")
|
||||
public void testContextReceiver() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/contextReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumEntry.kt")
|
||||
public void testEnumEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/enumEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("errorType.kt")
|
||||
public void testErrorType() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localTypeScope.kt")
|
||||
public void testLocalTypeScope() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/localTypeScope.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleScopeContextForPosition.kt")
|
||||
public void testSimpleScopeContextForPosition() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/simpleScopeContextForPosition.kt");
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2010-2023 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.impl.base.test.cases.scopes
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtScopeContext
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtScopeKind
|
||||
import org.jetbrains.kotlin.analysis.api.renderer.base.annotations.KtRendererAnnotationsFilter
|
||||
import org.jetbrains.kotlin.analysis.api.renderer.declarations.impl.KtDeclarationRendererForSource
|
||||
import org.jetbrains.kotlin.analysis.api.renderer.declarations.modifiers.renderers.KtRendererModifierFilter
|
||||
import org.jetbrains.kotlin.analysis.api.renderer.types.impl.KtTypeRendererForSource
|
||||
import org.jetbrains.kotlin.analysis.api.renderer.types.renderers.KtTypeErrorTypeRenderer
|
||||
import org.jetbrains.kotlin.analysis.api.scopes.KtScope
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.DebugSymbolRenderer
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtDeclarationSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtType
|
||||
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedSingleModuleTest
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.expressionMarkerProvider
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.prettyPrint
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.assertions
|
||||
|
||||
abstract class AbstractScopeContextForPositionTest : AbstractAnalysisApiBasedSingleModuleTest() {
|
||||
override fun doTestByFileStructure(ktFiles: List<KtFile>, module: TestModule, testServices: TestServices) {
|
||||
val ktFile = ktFiles.first()
|
||||
val element = testServices.expressionMarkerProvider.getSelectedElementOfType<KtElement>(ktFile)
|
||||
|
||||
analyseForTest(element) { elementToAnalyze ->
|
||||
val scopeContext = ktFile.getScopeContextForPosition(elementToAnalyze)
|
||||
|
||||
val scopeContextStringRepresentation = renderForTests(elementToAnalyze, scopeContext)
|
||||
val scopeContextStringRepresentationPretty = renderForTests(elementToAnalyze, scopeContext, printPretty = true)
|
||||
|
||||
testServices.assertions.assertEqualsToTestDataFileSibling(scopeContextStringRepresentation)
|
||||
testServices.assertions.assertEqualsToTestDataFileSibling(scopeContextStringRepresentationPretty, extension = ".pretty.txt")
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtAnalysisSession.renderForTests(
|
||||
element: KtElement,
|
||||
scopeContext: KtScopeContext,
|
||||
printPretty: Boolean = false
|
||||
): String = prettyPrint {
|
||||
appendLine("element: ${element.text}")
|
||||
appendLine("implicit receivers:")
|
||||
|
||||
withIndent {
|
||||
for (implicitReceiver in scopeContext.implicitReceivers) {
|
||||
val type = implicitReceiver.type
|
||||
appendLine("type: ${renderType(type, printPretty)}")
|
||||
appendLine("owner symbol: ${implicitReceiver.ownerSymbol::class.simpleName}")
|
||||
appendLine()
|
||||
}
|
||||
}
|
||||
appendLine("scopes:")
|
||||
withIndent {
|
||||
for (scopeWithKind in scopeContext.scopes) {
|
||||
appendLine(renderForTests(scopeWithKind.scope, scopeWithKind.kind, printPretty))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtAnalysisSession.renderForTests(scope: KtScope, scopeKind: KtScopeKind, printPretty: Boolean): String = prettyPrint {
|
||||
append("${scopeKind::class.simpleName}, index = ${scopeKind.indexInTower}")
|
||||
|
||||
if (scopeKind is KtScopeKind.DefaultSimpleImportingScope || scopeKind is KtScopeKind.DefaultStarImportingScope) {
|
||||
appendLine()
|
||||
return@prettyPrint
|
||||
}
|
||||
|
||||
val callables = scope.getCallableSymbols().toList()
|
||||
val classifiers = scope.getClassifierSymbols().toList()
|
||||
val isEmpty = callables.isEmpty() && classifiers.isEmpty()
|
||||
if (isEmpty) {
|
||||
appendLine(", empty")
|
||||
} else {
|
||||
appendLine()
|
||||
withIndent {
|
||||
appendLine("classifiers: ${classifiers.size}")
|
||||
withIndent { classifiers.forEach { appendLine(renderSymbol(it, printPretty)) } }
|
||||
appendLine("callables: ${callables.size}")
|
||||
withIndent { callables.forEach { appendLine(renderSymbol(it, printPretty)) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtAnalysisSession.renderType(
|
||||
type: KtType,
|
||||
printPretty: Boolean
|
||||
): String = prettyPrint {
|
||||
if (printPretty) prettyPrintTypeRenderer.renderType(type, this) else append(debugRenderer.renderType(type))
|
||||
}
|
||||
|
||||
|
||||
private fun KtAnalysisSession.renderSymbol(
|
||||
symbol: KtDeclarationSymbol,
|
||||
printPretty: Boolean
|
||||
): String = if (printPretty) symbol.render(prettyPrintSymbolRenderer) else debugRenderer.render(symbol)
|
||||
|
||||
companion object {
|
||||
private val debugRenderer = DebugSymbolRenderer()
|
||||
|
||||
private val prettyPrintTypeRenderer = KtTypeRendererForSource.WITH_QUALIFIED_NAMES.with {
|
||||
typeErrorTypeRenderer = KtTypeErrorTypeRenderer.WITH_ERROR_MESSAGE
|
||||
}
|
||||
private val prettyPrintSymbolRenderer = KtDeclarationRendererForSource.WITH_QUALIFIED_NAMES.with {
|
||||
annotationRenderer = annotationRenderer.with { annotationFilter = KtRendererAnnotationsFilter.NONE }
|
||||
modifiersRenderer = modifiersRenderer.with { modifierFilter = KtRendererModifierFilter.NONE }
|
||||
}
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2010-2023 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.standalone.fir.test.cases.generated.cases.scopes;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.standalone.fir.test.AnalysisApiFirStandaloneModeTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.scopes.AbstractScopeContextForPositionTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirStandaloneNormalAnalysisSourceModuleScopeContextForPositionTestGenerated extends AbstractScopeContextForPositionTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirStandaloneModeTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Standalone
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInScopeContextForPosition() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("contextReceiver.kt")
|
||||
public void testContextReceiver() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/contextReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumEntry.kt")
|
||||
public void testEnumEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/enumEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("errorType.kt")
|
||||
public void testErrorType() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localTypeScope.kt")
|
||||
public void testLocalTypeScope() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/localTypeScope.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleScopeContextForPosition.kt")
|
||||
public void testSimpleScopeContextForPosition() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/simpleScopeContextForPosition.kt");
|
||||
}
|
||||
}
|
||||
+99
-3
@@ -105,28 +105,124 @@ public interface KtScopeProviderMixIn : KtAnalysisSessionMixIn {
|
||||
/**
|
||||
* Scopes in returned [KtScopeContext] don't include synthetic Java properties.
|
||||
* To get such properties use [getSyntheticJavaPropertiesScope].
|
||||
*
|
||||
* For each scope in [KtScopeContext] an index is calculated. The indexes are relative to position, and they are only known for
|
||||
* scopes obtained with [getScopeContextForPosition].
|
||||
*/
|
||||
public fun KtFile.getScopeContextForPosition(positionInFakeFile: KtElement): KtScopeContext =
|
||||
withValidityAssertion { analysisSession.scopeProvider.getScopeContextForPosition(this, positionInFakeFile) }
|
||||
|
||||
public fun KtFile.getScopeContextForFile(): KtScopeContext =
|
||||
withValidityAssertion { analysisSession.scopeProvider.getScopeContextForPosition(this, this) }
|
||||
|
||||
/**
|
||||
* Returns single scope, containing declarations from all scopes that satisfy [filter]. The order of declarations corresponds to the
|
||||
* order of their containing scopes, which are sorted according to their indexes in scope tower.
|
||||
*/
|
||||
public fun KtScopeContext.getCompositeScope(filter: (KtScopeKind) -> Boolean = { true }): KtScope = withValidityAssertion {
|
||||
val subScopes = scopes.filter { filter(it.kind) }.map { it.scope }
|
||||
subScopes.asCompositeScope()
|
||||
}
|
||||
}
|
||||
|
||||
public class KtScopeContext(
|
||||
private val _scopes: KtScope,
|
||||
private val _scopes: List<KtScopeWithKind>,
|
||||
private val _implicitReceivers: List<KtImplicitReceiver>,
|
||||
override val token: KtLifetimeToken
|
||||
) : KtLifetimeOwner {
|
||||
public val implicitReceivers: List<KtImplicitReceiver> get() = withValidityAssertion { _implicitReceivers }
|
||||
public val scopes: KtScope get() = withValidityAssertion { _scopes }
|
||||
|
||||
/**
|
||||
* Scopes for position, sorted according to their indexes in scope tower, i.e. the first scope is the closest one to position.
|
||||
*/
|
||||
public val scopes: List<KtScopeWithKind> get() = withValidityAssertion { _scopes }
|
||||
}
|
||||
|
||||
public class KtImplicitReceiver(
|
||||
override val token: KtLifetimeToken,
|
||||
private val _type: KtType,
|
||||
private val _ownerSymbol: KtSymbol
|
||||
private val _ownerSymbol: KtSymbol,
|
||||
private val _receiverScopeIndexInTower: Int
|
||||
) : KtLifetimeOwner {
|
||||
public val ownerSymbol: KtSymbol get() = withValidityAssertion { _ownerSymbol }
|
||||
public val type: KtType get() = withValidityAssertion { _type }
|
||||
public val scopeIndexInTower: Int get() = withValidityAssertion { _receiverScopeIndexInTower }
|
||||
}
|
||||
|
||||
|
||||
public sealed class KtScopeKind {
|
||||
/**
|
||||
* Index in scope tower. For example:
|
||||
* ```
|
||||
* fun f(a: A, b: B) { // local scope: indexInTower = 2
|
||||
* with(a) { // type scope for A: indexInTower = 1
|
||||
* with(b) { // type scope for B: indexInTower = 0
|
||||
* <caret>
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public abstract val indexInTower: Int
|
||||
|
||||
public class LocalScope(override val indexInTower: Int) : KtScopeKind()
|
||||
|
||||
public sealed class TypeScope : KtScopeKind()
|
||||
|
||||
/**
|
||||
* Represents [KtTypeScope], which doesn't include synthetic Java properties of corresponding type.
|
||||
*/
|
||||
public class SimpleTypeScope(override val indexInTower: Int) : TypeScope()
|
||||
public class SyntheticJavaPropertiesScope(override val indexInTower: Int) : TypeScope()
|
||||
|
||||
public sealed class NonLocalScope : KtScopeKind()
|
||||
|
||||
/**
|
||||
* Represents [KtScope] containing type parameters.
|
||||
*/
|
||||
public class TypeParameterScope(override val indexInTower: Int) : NonLocalScope()
|
||||
|
||||
/**
|
||||
* Represents [KtScope] containing declarations from package.
|
||||
*/
|
||||
public class PackageMemberScope(override val indexInTower: Int) : NonLocalScope()
|
||||
|
||||
/**
|
||||
* Represents [KtScope] containing declarations from imports.
|
||||
*/
|
||||
public sealed class ImportingScope : NonLocalScope()
|
||||
|
||||
/**
|
||||
* Represents [KtScope] containing declarations from explicit non-star imports.
|
||||
*/
|
||||
public class ExplicitSimpleImportingScope(override val indexInTower: Int) : ImportingScope()
|
||||
|
||||
/**
|
||||
* Represents [KtScope] containing declarations from explicit star imports.
|
||||
*/
|
||||
public class ExplicitStarImportingScope(override val indexInTower: Int) : ImportingScope()
|
||||
|
||||
/**
|
||||
* Represents [KtScope] containing declarations from non-star imports which are not declared explicitly and are added by default.
|
||||
*/
|
||||
public class DefaultSimpleImportingScope(override val indexInTower: Int) : ImportingScope()
|
||||
|
||||
/**
|
||||
* Represents [KtScope] containing declarations from star imports which are not declared explicitly and are added by default.
|
||||
*/
|
||||
public class DefaultStarImportingScope(override val indexInTower: Int) : ImportingScope()
|
||||
|
||||
/**
|
||||
* Represents [KtScope] containing static members of a classifier.
|
||||
*/
|
||||
public class StaticMemberScope(override val indexInTower: Int) : NonLocalScope()
|
||||
}
|
||||
|
||||
public data class KtScopeWithKind(
|
||||
private val _scope: KtScope,
|
||||
private val _kind: KtScopeKind,
|
||||
override val token: KtLifetimeToken
|
||||
) : KtLifetimeOwner {
|
||||
public val scope: KtScope get() = withValidityAssertion { _scope }
|
||||
public val kind: KtScopeKind get() = withValidityAssertion { _kind }
|
||||
}
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
class Context {
|
||||
fun memberInContext() {}
|
||||
}
|
||||
context(Context)
|
||||
fun test() {
|
||||
<expr>e</expr>
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: Context
|
||||
owner symbol: KtFirFunctionSymbol
|
||||
|
||||
scopes:
|
||||
LocalScope, index = 0, empty
|
||||
|
||||
SimpleTypeScope, index = 1
|
||||
classifiers: 0
|
||||
callables: 4
|
||||
fun memberInContext()
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
|
||||
LocalScope, index = 2, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 3, empty
|
||||
|
||||
PackageMemberScope, index = 4
|
||||
classifiers: 1
|
||||
class Context
|
||||
callables: 1
|
||||
context(Context)
|
||||
fun test()
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
|
||||
DefaultSimpleImportingScope, index = 6
|
||||
|
||||
ExplicitStarImportingScope, index = 7, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 8
|
||||
|
||||
DefaultStarImportingScope, index = 9
|
||||
|
||||
DefaultStarImportingScope, index = 10
|
||||
Vendored
+220
@@ -0,0 +1,220 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: Context
|
||||
owner symbol: KtFirFunctionSymbol
|
||||
|
||||
scopes:
|
||||
LocalScope, index = 0, empty
|
||||
|
||||
SimpleTypeScope, index = 1
|
||||
classifiers: 0
|
||||
callables: 4
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /Context.memberInContext
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: memberInContext
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.equals
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: true
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: equals
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Boolean
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: other
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.hashCode
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: hashCode
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.toString
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: toString
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
LocalScope, index = 2, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 3, empty
|
||||
|
||||
PackageMemberScope, index = 4
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: Context
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: Context
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
callables: 1
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /test
|
||||
contextReceivers: [
|
||||
KtContextReceiver:
|
||||
label: null
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: Context
|
||||
]
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: test
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
|
||||
DefaultSimpleImportingScope, index = 6
|
||||
|
||||
ExplicitStarImportingScope, index = 7, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 8
|
||||
|
||||
DefaultStarImportingScope, index = 9
|
||||
|
||||
DefaultStarImportingScope, index = 10
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
enum class E {
|
||||
A {
|
||||
val x: String = ""
|
||||
fun foo() {
|
||||
<expr>e</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/enumEntry.pretty.txt
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: `<anonymous>`
|
||||
owner symbol: KtFirAnonymousObjectSymbol
|
||||
|
||||
type: kotlin.Enum.Companion
|
||||
owner symbol: KtFirNamedClassOrObjectSymbol
|
||||
|
||||
scopes:
|
||||
LocalScope, index = 0, empty
|
||||
|
||||
LocalScope, index = 1, empty
|
||||
|
||||
SimpleTypeScope, index = 2
|
||||
classifiers: 1
|
||||
companion object
|
||||
callables: 9
|
||||
val x: kotlin.String
|
||||
fun foo()
|
||||
fun clone(): kotlin.Any
|
||||
fun compareTo(other: E): kotlin.Int
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
val name: kotlin.String
|
||||
val ordinal: kotlin.Int
|
||||
|
||||
StaticMemberScope, index = 3
|
||||
classifiers: 0
|
||||
callables: 4
|
||||
A
|
||||
fun values(): kotlin.Array<E>
|
||||
fun valueOf(value: kotlin.String): E
|
||||
val entries: kotlin.enums.EnumEntries<E>
|
||||
|
||||
StaticMemberScope, index = 4
|
||||
classifiers: 1
|
||||
companion object
|
||||
callables: 0
|
||||
|
||||
SimpleTypeScope, index = 5
|
||||
classifiers: 0
|
||||
callables: 3
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
|
||||
ExplicitSimpleImportingScope, index = 6, empty
|
||||
|
||||
PackageMemberScope, index = 7
|
||||
classifiers: 1
|
||||
enum class E
|
||||
callables: 0
|
||||
|
||||
DefaultSimpleImportingScope, index = 8
|
||||
|
||||
DefaultSimpleImportingScope, index = 9
|
||||
|
||||
ExplicitStarImportingScope, index = 10, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 11
|
||||
|
||||
DefaultStarImportingScope, index = 12
|
||||
|
||||
DefaultStarImportingScope, index = 13
|
||||
Vendored
+736
@@ -0,0 +1,736 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: <anonymous>
|
||||
owner symbol: KtFirAnonymousObjectSymbol
|
||||
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Enum.Companion
|
||||
owner symbol: KtFirNamedClassOrObjectSymbol
|
||||
|
||||
scopes:
|
||||
LocalScope, index = 0, empty
|
||||
|
||||
LocalScope, index = 1, empty
|
||||
|
||||
SimpleTypeScope, index = 2
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: kotlin/Enum.Companion
|
||||
classKind: COMPANION_OBJECT
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: Companion
|
||||
origin: LIBRARY
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
callables: 9
|
||||
KtKotlinPropertySymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
getter: KtPropertyGetterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
hasBody: false
|
||||
hasStableParameterNames: true
|
||||
isDefault: true
|
||||
isExtension: false
|
||||
isInline: false
|
||||
isOverride: false
|
||||
modality: FINAL
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: ACCESSOR
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
hasBackingField: true
|
||||
hasGetter: true
|
||||
hasSetter: false
|
||||
initializer: KtConstantInitializerValue("")
|
||||
isConst: false
|
||||
isDelegatedProperty: false
|
||||
isExtension: false
|
||||
isFromPrimaryConstructor: false
|
||||
isLateInit: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isVal: true
|
||||
modality: FINAL
|
||||
name: x
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
setter: null
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Enum.clone
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: clone
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Protected
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /E.compareTo
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: true
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: compareTo
|
||||
origin: SUBSTITUTION_OVERRIDE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: other
|
||||
origin: SUBSTITUTION_OVERRIDE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: E
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Enum.equals
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: true
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: equals
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Boolean
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: other
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Enum.hashCode
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: hashCode
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Enum.toString
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: toString
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtKotlinPropertySymbol:
|
||||
annotationsList: [
|
||||
kotlin/internal/IntrinsicConstEvaluation()
|
||||
psi: null
|
||||
]
|
||||
callableIdIfNonLocal: kotlin/Enum.name
|
||||
contextReceivers: []
|
||||
getter: KtPropertyGetterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
hasBody: false
|
||||
hasStableParameterNames: true
|
||||
isDefault: true
|
||||
isExtension: false
|
||||
isInline: false
|
||||
isOverride: false
|
||||
modality: FINAL
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: ACCESSOR
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
hasBackingField: true
|
||||
hasGetter: true
|
||||
hasSetter: false
|
||||
initializer: null
|
||||
isConst: false
|
||||
isDelegatedProperty: false
|
||||
isExtension: false
|
||||
isFromPrimaryConstructor: false
|
||||
isLateInit: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isVal: true
|
||||
modality: FINAL
|
||||
name: name
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
setter: null
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
KtKotlinPropertySymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Enum.ordinal
|
||||
contextReceivers: []
|
||||
getter: KtPropertyGetterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
hasBody: false
|
||||
hasStableParameterNames: true
|
||||
isDefault: true
|
||||
isExtension: false
|
||||
isInline: false
|
||||
isOverride: false
|
||||
modality: FINAL
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: ACCESSOR
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
hasBackingField: true
|
||||
hasGetter: true
|
||||
hasSetter: false
|
||||
initializer: null
|
||||
isConst: false
|
||||
isDelegatedProperty: false
|
||||
isExtension: false
|
||||
isFromPrimaryConstructor: false
|
||||
isLateInit: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isVal: true
|
||||
modality: FINAL
|
||||
name: ordinal
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
setter: null
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
StaticMemberScope, index = 3
|
||||
classifiers: 0
|
||||
callables: 4
|
||||
KtEnumEntrySymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /E.A
|
||||
containingEnumClassIdIfNonLocal: E
|
||||
contextReceivers: []
|
||||
isExtension: false
|
||||
name: A
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: E
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /E.values
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: true
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: values
|
||||
origin: SOURCE_MEMBER_GENERATED
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: E
|
||||
]
|
||||
type: kotlin/Array<E>
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /E.valueOf
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: true
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: valueOf
|
||||
origin: SOURCE_MEMBER_GENERATED
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: E
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: value
|
||||
origin: SOURCE_MEMBER_GENERATED
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtKotlinPropertySymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /E.entries
|
||||
contextReceivers: []
|
||||
getter: KtPropertyGetterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
hasBody: false
|
||||
hasStableParameterNames: true
|
||||
isDefault: true
|
||||
isExtension: false
|
||||
isInline: false
|
||||
isOverride: false
|
||||
modality: FINAL
|
||||
origin: SOURCE_MEMBER_GENERATED
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: E
|
||||
]
|
||||
type: kotlin/enums/EnumEntries<E>
|
||||
symbolKind: ACCESSOR
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
hasBackingField: false
|
||||
hasGetter: true
|
||||
hasSetter: false
|
||||
initializer: null
|
||||
isConst: false
|
||||
isDelegatedProperty: false
|
||||
isExtension: false
|
||||
isFromPrimaryConstructor: false
|
||||
isLateInit: false
|
||||
isOverride: false
|
||||
isStatic: true
|
||||
isVal: true
|
||||
modality: FINAL
|
||||
name: entries
|
||||
origin: SOURCE_MEMBER_GENERATED
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: E
|
||||
]
|
||||
type: kotlin/enums/EnumEntries<E>
|
||||
setter: null
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
StaticMemberScope, index = 4
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: kotlin/Enum.Companion
|
||||
classKind: COMPANION_OBJECT
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: Companion
|
||||
origin: LIBRARY
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
callables: 0
|
||||
|
||||
SimpleTypeScope, index = 5
|
||||
classifiers: 0
|
||||
callables: 3
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.equals
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: true
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: equals
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Boolean
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: other
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.hashCode
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: hashCode
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.toString
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: toString
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
ExplicitSimpleImportingScope, index = 6, empty
|
||||
|
||||
PackageMemberScope, index = 7
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: E
|
||||
classKind: ENUM_CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: E
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: E
|
||||
]
|
||||
type: kotlin/Enum<E>
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
callables: 0
|
||||
|
||||
DefaultSimpleImportingScope, index = 8
|
||||
|
||||
DefaultSimpleImportingScope, index = 9
|
||||
|
||||
ExplicitStarImportingScope, index = 10, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 11
|
||||
|
||||
DefaultStarImportingScope, index = 12
|
||||
|
||||
DefaultStarImportingScope, index = 13
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
interface List<T> {
|
||||
fun add(e: T)
|
||||
fun get(index: Int): T
|
||||
}
|
||||
|
||||
inline fun <E> buildList(f: List<E>.() -> Unit): List<E> = l
|
||||
|
||||
fun test() {
|
||||
buildList {
|
||||
with(this.get(0)) {
|
||||
<expr>e</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.pretty.txt
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: ERROR(Cannot infer argument for type parameter E)
|
||||
owner symbol: KtFirAnonymousFunctionSymbol
|
||||
|
||||
type: List<ERROR(Cannot infer argument for type parameter E)>
|
||||
owner symbol: KtFirAnonymousFunctionSymbol
|
||||
|
||||
scopes:
|
||||
SimpleTypeScope, index = 0, empty
|
||||
|
||||
LocalScope, index = 1, empty
|
||||
|
||||
LocalScope, index = 2, empty
|
||||
|
||||
SimpleTypeScope, index = 3
|
||||
classifiers: 0
|
||||
callables: 5
|
||||
fun add(e: T)
|
||||
fun get(index: kotlin.Int): T
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
|
||||
LocalScope, index = 4, empty
|
||||
|
||||
LocalScope, index = 5, empty
|
||||
|
||||
LocalScope, index = 6, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7, empty
|
||||
|
||||
PackageMemberScope, index = 8
|
||||
classifiers: 1
|
||||
interface List<T>
|
||||
callables: 2
|
||||
fun <E> buildList(f: List<E>.() -> kotlin.Unit): List<E>
|
||||
fun test()
|
||||
|
||||
DefaultSimpleImportingScope, index = 9
|
||||
|
||||
DefaultSimpleImportingScope, index = 10
|
||||
|
||||
ExplicitStarImportingScope, index = 11, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 12
|
||||
|
||||
DefaultStarImportingScope, index = 13
|
||||
|
||||
DefaultStarImportingScope, index = 14
|
||||
Vendored
+366
@@ -0,0 +1,366 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: KtTypeErrorType:
|
||||
annotationsList: []
|
||||
type: ERROR CLASS: Cannot infer argument for type parameter E
|
||||
owner symbol: KtFirAnonymousFunctionSymbol
|
||||
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtTypeErrorType:
|
||||
annotationsList: []
|
||||
type: ERROR CLASS: Cannot infer argument for type parameter E
|
||||
]
|
||||
type: List<ERROR CLASS: Cannot infer argument for type parameter E>
|
||||
owner symbol: KtFirAnonymousFunctionSymbol
|
||||
|
||||
scopes:
|
||||
SimpleTypeScope, index = 0, empty
|
||||
|
||||
LocalScope, index = 1, empty
|
||||
|
||||
LocalScope, index = 2, empty
|
||||
|
||||
SimpleTypeScope, index = 3
|
||||
classifiers: 0
|
||||
callables: 5
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /List.add
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: ABSTRACT
|
||||
name: add
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: e
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: T
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /List.get
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: ABSTRACT
|
||||
name: get
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: T
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: index
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.equals
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: true
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: equals
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Boolean
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: other
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.hashCode
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: hashCode
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.toString
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: toString
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
LocalScope, index = 4, empty
|
||||
|
||||
LocalScope, index = 5, empty
|
||||
|
||||
LocalScope, index = 6, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7, empty
|
||||
|
||||
PackageMemberScope, index = 8
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: List
|
||||
classKind: INTERFACE
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: ABSTRACT
|
||||
name: List
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: [
|
||||
KtTypeParameterSymbol(T)
|
||||
]
|
||||
visibility: Public
|
||||
callables: 2
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /buildList
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: true
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: buildList
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
]
|
||||
type: List<E>
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: [
|
||||
KtTypeParameterSymbol(E)
|
||||
]
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: f
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtFunctionalType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
]
|
||||
type: List<E>
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
]
|
||||
type: @ExtensionFunctionType kotlin/Function1<List<E>, kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /test
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: test
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
DefaultSimpleImportingScope, index = 9
|
||||
|
||||
DefaultSimpleImportingScope, index = 10
|
||||
|
||||
ExplicitStarImportingScope, index = 11, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 12
|
||||
|
||||
DefaultStarImportingScope, index = 13
|
||||
|
||||
DefaultStarImportingScope, index = 14
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
fun z() {
|
||||
val localInZ = 3
|
||||
class Y {
|
||||
val propertyInY = 2
|
||||
fun x() {
|
||||
val localInX = 1
|
||||
<expr>e</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: Y
|
||||
owner symbol: KtFirNamedClassOrObjectSymbol
|
||||
|
||||
scopes:
|
||||
LocalScope, index = 0
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
val localInX: kotlin.Int
|
||||
|
||||
LocalScope, index = 1, empty
|
||||
|
||||
SimpleTypeScope, index = 2
|
||||
classifiers: 0
|
||||
callables: 5
|
||||
val propertyInY: kotlin.Int
|
||||
fun x()
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
|
||||
LocalScope, index = 3
|
||||
classifiers: 1
|
||||
class Y
|
||||
callables: 1
|
||||
val localInZ: kotlin.Int
|
||||
|
||||
LocalScope, index = 4, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 5, empty
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
fun z()
|
||||
|
||||
DefaultSimpleImportingScope, index = 7
|
||||
|
||||
DefaultSimpleImportingScope, index = 8
|
||||
|
||||
ExplicitStarImportingScope, index = 9, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 10
|
||||
|
||||
DefaultStarImportingScope, index = 11
|
||||
|
||||
DefaultStarImportingScope, index = 12
|
||||
|
||||
Vendored
+301
@@ -0,0 +1,301 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: Y
|
||||
owner symbol: KtFirNamedClassOrObjectSymbol
|
||||
|
||||
scopes:
|
||||
LocalScope, index = 0
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
KtLocalVariableSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
isExtension: false
|
||||
isVal: true
|
||||
name: localInX
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
|
||||
LocalScope, index = 1, empty
|
||||
|
||||
SimpleTypeScope, index = 2
|
||||
classifiers: 0
|
||||
callables: 5
|
||||
KtKotlinPropertySymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
getter: KtPropertyGetterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
hasBody: false
|
||||
hasStableParameterNames: true
|
||||
isDefault: true
|
||||
isExtension: false
|
||||
isInline: false
|
||||
isOverride: false
|
||||
modality: FINAL
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: ACCESSOR
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
hasBackingField: true
|
||||
hasGetter: true
|
||||
hasSetter: false
|
||||
initializer: KtConstantInitializerValue(2)
|
||||
isConst: false
|
||||
isDelegatedProperty: false
|
||||
isExtension: false
|
||||
isFromPrimaryConstructor: false
|
||||
isLateInit: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isVal: true
|
||||
modality: FINAL
|
||||
name: propertyInY
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
setter: null
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: x
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.equals
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: true
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: equals
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Boolean
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: other
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.hashCode
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: hashCode
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.toString
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: toString
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
LocalScope, index = 3
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: null
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: Y
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
visibility: Local
|
||||
callables: 1
|
||||
KtLocalVariableSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
isExtension: false
|
||||
isVal: true
|
||||
name: localInZ
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
|
||||
LocalScope, index = 4, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 5, empty
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /z
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: z
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
DefaultSimpleImportingScope, index = 7
|
||||
|
||||
DefaultSimpleImportingScope, index = 8
|
||||
|
||||
ExplicitStarImportingScope, index = 9, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 10
|
||||
|
||||
DefaultStarImportingScope, index = 11
|
||||
|
||||
DefaultStarImportingScope, index = 12
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
class NestedInJavaClass {
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
class A {
|
||||
fun memberInA() {}
|
||||
}
|
||||
|
||||
class B {
|
||||
fun memberInB() {}
|
||||
}
|
||||
|
||||
fun withA(f: A.() -> Unit) {}
|
||||
|
||||
fun withB(f: B.() -> Unit) {}
|
||||
|
||||
fun withJavaClass(f: JavaClass.() -> Unit) {}
|
||||
|
||||
fun topLevel() = 1
|
||||
|
||||
class C: JavaClass() {
|
||||
fun <T> methodInC(param: String?) {
|
||||
val localVarB = 2
|
||||
fun localFunB() {}
|
||||
param?.let { lambdaArg ->
|
||||
val localVarA = 1
|
||||
withB {
|
||||
withA {
|
||||
<expr>e</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class NestedInC
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: A
|
||||
owner symbol: KtFirAnonymousFunctionSymbol
|
||||
|
||||
type: B
|
||||
owner symbol: KtFirAnonymousFunctionSymbol
|
||||
|
||||
type: C
|
||||
owner symbol: KtFirNamedClassOrObjectSymbol
|
||||
|
||||
scopes:
|
||||
SimpleTypeScope, index = 0
|
||||
classifiers: 0
|
||||
callables: 4
|
||||
fun memberInA()
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
|
||||
LocalScope, index = 1, empty
|
||||
|
||||
LocalScope, index = 2, empty
|
||||
|
||||
SimpleTypeScope, index = 3
|
||||
classifiers: 0
|
||||
callables: 4
|
||||
fun memberInB()
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
|
||||
LocalScope, index = 4, empty
|
||||
|
||||
LocalScope, index = 5
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
val localVarA: kotlin.Int
|
||||
|
||||
LocalScope, index = 6
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
lambdaArg: kotlin.String
|
||||
|
||||
LocalScope, index = 7
|
||||
classifiers: 0
|
||||
callables: 2
|
||||
val localVarB: kotlin.Int
|
||||
fun localFunB()
|
||||
|
||||
LocalScope, index = 8
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
param: kotlin.String?
|
||||
|
||||
TypeParameterScope, index = 9
|
||||
classifiers: 1
|
||||
T
|
||||
callables: 0
|
||||
|
||||
SimpleTypeScope, index = 10
|
||||
classifiers: 2
|
||||
class NestedInC
|
||||
class NestedInJavaClass
|
||||
callables: 4
|
||||
fun <T> methodInC(param: kotlin.String?)
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
|
||||
StaticMemberScope, index = 11
|
||||
classifiers: 1
|
||||
class NestedInC
|
||||
callables: 0
|
||||
|
||||
StaticMemberScope, index = 12
|
||||
classifiers: 1
|
||||
class NestedInJavaClass
|
||||
callables: 0
|
||||
|
||||
ExplicitSimpleImportingScope, index = 13, empty
|
||||
|
||||
PackageMemberScope, index = 14
|
||||
classifiers: 3
|
||||
class C : JavaClass()
|
||||
class B
|
||||
class A
|
||||
callables: 4
|
||||
fun withJavaClass(f: JavaClass.() -> kotlin.Unit)
|
||||
fun topLevel(): kotlin.Int
|
||||
fun withB(f: B.() -> kotlin.Unit)
|
||||
fun withA(f: A.() -> kotlin.Unit)
|
||||
|
||||
DefaultSimpleImportingScope, index = 15
|
||||
|
||||
DefaultSimpleImportingScope, index = 16
|
||||
|
||||
ExplicitStarImportingScope, index = 17, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 18
|
||||
|
||||
DefaultStarImportingScope, index = 19
|
||||
|
||||
DefaultStarImportingScope, index = 20
|
||||
|
||||
+959
@@ -0,0 +1,959 @@
|
||||
element: e
|
||||
implicit receivers:
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: A
|
||||
owner symbol: KtFirAnonymousFunctionSymbol
|
||||
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: B
|
||||
owner symbol: KtFirAnonymousFunctionSymbol
|
||||
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: C
|
||||
owner symbol: KtFirNamedClassOrObjectSymbol
|
||||
|
||||
scopes:
|
||||
SimpleTypeScope, index = 0
|
||||
classifiers: 0
|
||||
callables: 4
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /A.memberInA
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: memberInA
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.equals
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: true
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: equals
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Boolean
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: other
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.hashCode
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: hashCode
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.toString
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: toString
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
LocalScope, index = 1, empty
|
||||
|
||||
LocalScope, index = 2, empty
|
||||
|
||||
SimpleTypeScope, index = 3
|
||||
classifiers: 0
|
||||
callables: 4
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /B.memberInB
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: memberInB
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.equals
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: true
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: equals
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Boolean
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: other
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.hashCode
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: hashCode
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.toString
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: toString
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
LocalScope, index = 4, empty
|
||||
|
||||
LocalScope, index = 5
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
KtLocalVariableSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
isExtension: false
|
||||
isVal: true
|
||||
name: localVarA
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
|
||||
LocalScope, index = 6
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: lambdaArg
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
|
||||
LocalScope, index = 7
|
||||
classifiers: 0
|
||||
callables: 2
|
||||
KtLocalVariableSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
isExtension: false
|
||||
isVal: true
|
||||
name: localVarB
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: localFunB
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Local
|
||||
|
||||
LocalScope, index = 8
|
||||
classifiers: 0
|
||||
callables: 1
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: param
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
|
||||
TypeParameterScope, index = 9
|
||||
classifiers: 1
|
||||
KtTypeParameterSymbol:
|
||||
annotationsList: []
|
||||
isReified: false
|
||||
name: T
|
||||
origin: SOURCE
|
||||
typeParameters: []
|
||||
upperBounds: []
|
||||
variance: INVARIANT
|
||||
callables: 0
|
||||
|
||||
SimpleTypeScope, index = 10
|
||||
classifiers: 2
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: C.NestedInC
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: NestedInC
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: JavaClass.NestedInJavaClass
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: true
|
||||
modality: OPEN
|
||||
name: NestedInJavaClass
|
||||
origin: JAVA
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: PackageVisibility
|
||||
callables: 4
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /C.methodInC
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: methodInC
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: [
|
||||
KtTypeParameterSymbol(T)
|
||||
]
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: param
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.equals
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: true
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: equals
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Boolean
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: other
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.hashCode
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: hashCode
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/Any.toString
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: toString
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
StaticMemberScope, index = 11
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: C.NestedInC
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: NestedInC
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
callables: 0
|
||||
|
||||
StaticMemberScope, index = 12
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: JavaClass.NestedInJavaClass
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: true
|
||||
modality: OPEN
|
||||
name: NestedInJavaClass
|
||||
origin: JAVA
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: PackageVisibility
|
||||
callables: 0
|
||||
|
||||
ExplicitSimpleImportingScope, index = 13, empty
|
||||
|
||||
PackageMemberScope, index = 14
|
||||
classifiers: 3
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: C
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: C
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: JavaClass
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: B
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: B
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: A
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: A
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
callables: 4
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /withJavaClass
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: withJavaClass
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: f
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtFunctionalType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: JavaClass
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
]
|
||||
type: @ExtensionFunctionType kotlin/Function1<JavaClass, kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /topLevel
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: topLevel
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Int
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /withB
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: withB
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: f
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtFunctionalType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: B
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
]
|
||||
type: @ExtensionFunctionType kotlin/Function1<B, kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: /withA
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: withA
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: f
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: KtFunctionalType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: A
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Unit
|
||||
]
|
||||
type: @ExtensionFunctionType kotlin/Function1<A, kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
]
|
||||
visibility: Public
|
||||
|
||||
DefaultSimpleImportingScope, index = 15
|
||||
|
||||
DefaultSimpleImportingScope, index = 16
|
||||
|
||||
ExplicitStarImportingScope, index = 17, empty
|
||||
|
||||
DefaultSimpleImportingScope, index = 18
|
||||
|
||||
DefaultStarImportingScope, index = 19
|
||||
|
||||
DefaultStarImportingScope, index = 20
|
||||
|
||||
+5
-4
@@ -177,17 +177,18 @@ abstract class AbstractAnalysisApiBasedTest : TestWithDisposable() {
|
||||
private fun isFirDisabledForTheTest(): Boolean =
|
||||
AnalysisApiTestDirectives.IGNORE_FIR in testServices.moduleStructure.allDirectives
|
||||
|
||||
protected fun <R> analyseForTest(contextElement: KtElement, action: KtAnalysisSession.() -> R): R {
|
||||
protected fun <R> analyseForTest(contextElement: KtElement, action: KtAnalysisSession.(KtElement) -> R): R {
|
||||
return if (configurator.analyseInDependentSession) {
|
||||
val originalContainingFile = contextElement.containingKtFile
|
||||
val fileCopy = originalContainingFile.copy() as KtFile
|
||||
val sameElementInCopy = PsiTreeUtil.findSameElementInCopy(contextElement, fileCopy)
|
||||
analyzeInDependedAnalysisSession(
|
||||
originalContainingFile,
|
||||
PsiTreeUtil.findSameElementInCopy(contextElement, fileCopy),
|
||||
action = action
|
||||
sameElementInCopy,
|
||||
action = { action(sameElementInCopy) }
|
||||
)
|
||||
} else {
|
||||
analyze(contextElement, action = action)
|
||||
analyze(contextElement, action = { action(contextElement) })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
private class FirNestedClassifierScopeWithSubstitution(
|
||||
class FirNestedClassifierScopeWithSubstitution internal constructor(
|
||||
private val scope: FirContainingNamesAwareScope,
|
||||
private val substitutor: ConeSubstitutor
|
||||
) : FirContainingNamesAwareScope() {
|
||||
|
||||
+6
@@ -416,5 +416,11 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
||||
model("typeScope")
|
||||
}
|
||||
}
|
||||
|
||||
group(filter = frontendIs(FrontendKind.Fir)) {
|
||||
test(AbstractScopeContextForPositionTest::class) {
|
||||
model("scopeContextForPosition")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user