diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeDependentAnalysisSourceModuleTypeScopeTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeDependentAnalysisSourceModuleTypeScopeTestGenerated.java new file mode 100644 index 00000000000..08b848d7358 --- /dev/null +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeDependentAnalysisSourceModuleTypeScopeTestGenerated.java @@ -0,0 +1,84 @@ +/* + * Copyright 2010-2021 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.AbstractTypeScopeTest; +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 GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("analysis/analysis-api/testData/components/scopeProvider/typeScope") +@TestDataPath("$PROJECT_ROOT") +public class FirIdeDependentAnalysisSourceModuleTypeScopeTestGenerated extends AbstractTypeScopeTest { + @NotNull + @Override + public AnalysisApiTestConfigurator getConfigurator() { + return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator( + new AnalysisApiTestConfiguratorFactoryData( + FrontendKind.Fir, + TestModuleKind.Source, + AnalysisSessionMode.Dependent, + AnalysisApiMode.Ide + ) + ); + } + + @Test + public void testAllFilesPresentInTypeScope() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/scopeProvider/typeScope"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("errorType.kt") + public void testErrorType() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.kt"); + } + + @Test + @TestMetadata("innerClassTypeParamsSubstitution.kt") + public void testInnerClassTypeParamsSubstitution() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt"); + } + + @Test + @TestMetadata("intList.kt") + public void testIntList() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.kt"); + } + + @Test + @TestMetadata("outerClassTypeParamsSubstitution.kt") + public void testOuterClassTypeParamsSubstitution() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.kt"); + } + + @Test + @TestMetadata("outerTypeParamsSubstitution.kt") + public void testOuterTypeParamsSubstitution() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.kt"); + } + + @Test + @TestMetadata("typeParamList.kt") + public void testTypeParamList() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.kt"); + } +} diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated.java new file mode 100644 index 00000000000..c8909c1dcf1 --- /dev/null +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated.java @@ -0,0 +1,84 @@ +/* + * Copyright 2010-2021 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.AbstractTypeScopeTest; +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 GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("analysis/analysis-api/testData/components/scopeProvider/typeScope") +@TestDataPath("$PROJECT_ROOT") +public class FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated extends AbstractTypeScopeTest { + @NotNull + @Override + public AnalysisApiTestConfigurator getConfigurator() { + return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator( + new AnalysisApiTestConfiguratorFactoryData( + FrontendKind.Fir, + TestModuleKind.Source, + AnalysisSessionMode.Normal, + AnalysisApiMode.Ide + ) + ); + } + + @Test + public void testAllFilesPresentInTypeScope() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/scopeProvider/typeScope"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("errorType.kt") + public void testErrorType() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.kt"); + } + + @Test + @TestMetadata("innerClassTypeParamsSubstitution.kt") + public void testInnerClassTypeParamsSubstitution() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt"); + } + + @Test + @TestMetadata("intList.kt") + public void testIntList() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.kt"); + } + + @Test + @TestMetadata("outerClassTypeParamsSubstitution.kt") + public void testOuterClassTypeParamsSubstitution() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.kt"); + } + + @Test + @TestMetadata("outerTypeParamsSubstitution.kt") + public void testOuterTypeParamsSubstitution() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.kt"); + } + + @Test + @TestMetadata("typeParamList.kt") + public void testTypeParamList() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.kt"); + } +} diff --git a/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/components/testUtils.kt b/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/components/testUtils.kt index c004f51f7c6..d3af0fec79a 100644 --- a/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/components/testUtils.kt +++ b/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/components/testUtils.kt @@ -12,9 +12,14 @@ import org.jetbrains.kotlin.analysis.api.calls.KtCall import org.jetbrains.kotlin.analysis.api.calls.KtCallableMemberCall import org.jetbrains.kotlin.analysis.api.diagnostics.KtDiagnostic import org.jetbrains.kotlin.analysis.api.impl.base.KtMapBackedSubstitutor +import org.jetbrains.kotlin.analysis.api.signatures.KtCallableSignature +import org.jetbrains.kotlin.analysis.api.signatures.KtFunctionLikeSignature +import org.jetbrains.kotlin.analysis.api.signatures.KtVariableLikeSignature import org.jetbrains.kotlin.analysis.api.symbols.* +import org.jetbrains.kotlin.analysis.api.symbols.markers.KtNamedSymbol import org.jetbrains.kotlin.analysis.api.types.KtSubstitutor import org.jetbrains.kotlin.analysis.api.types.KtType +import org.jetbrains.kotlin.analysis.utils.printer.prettyPrint import org.jetbrains.kotlin.name.CallableId import org.jetbrains.kotlin.name.Name import kotlin.reflect.KProperty1 @@ -105,6 +110,35 @@ internal fun KtAnalysisSession.stringRepresentation(any: Any): String = with(any } } +internal fun KtAnalysisSession.prettyPrintSignature(signature: KtCallableSignature<*>): String = prettyPrint { + when (signature) { + is KtFunctionLikeSignature -> { + append("fun ") + signature.receiverType?.let { append('.'); append(it.render()) } + append((signature.symbol as KtNamedSymbol).name.asString()) + printCollection(signature.valueParameters, prefix = "(", postfix = ")") { parameter -> + append(parameter.name.asString()) + append(": ") + append(parameter.returnType.render()) + } + append(": ") + append(signature.returnType.render()) + } + is KtVariableLikeSignature -> { + val symbol = signature.symbol + if (symbol is KtVariableSymbol) { + append(if (symbol.isVal) "val" else "var") + append(" ") + } + signature.receiverType?.let { append('.'); append(it.render()) } + append((symbol as KtNamedSymbol).name.asString()) + append(": ") + append(signature.returnType.render()) + } + } +} + + internal fun KtAnalysisSession.compareCalls(call1: KtCall, call2: KtCall): Int { // The order of candidate calls is non-deterministic. Sort by symbol string value. if (call1 !is KtCallableMemberCall<*, *> || call2 !is KtCallableMemberCall<*, *>) return 0 diff --git a/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/scopes/AbstractTypeScopeTest.kt b/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/scopes/AbstractTypeScopeTest.kt new file mode 100644 index 00000000000..a289cd4f7ba --- /dev/null +++ b/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/scopes/AbstractTypeScopeTest.kt @@ -0,0 +1,103 @@ +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.api.impl.base.test.cases.scopes + +import org.jetbrains.kotlin.analysis.api.KtAnalysisSession +import org.jetbrains.kotlin.analysis.api.components.KtDeclarationRendererOptions +import org.jetbrains.kotlin.analysis.api.components.RendererModifier +import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.prettyPrintSignature +import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.stringRepresentation +import org.jetbrains.kotlin.analysis.api.scopes.KtScope +import org.jetbrains.kotlin.analysis.api.scopes.KtTypeScope +import org.jetbrains.kotlin.analysis.api.symbols.DebugSymbolRenderer +import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiSingleFileTest +import org.jetbrains.kotlin.analysis.test.framework.services.expressionMarkerProvider +import org.jetbrains.kotlin.analysis.utils.printer.prettyPrint +import org.jetbrains.kotlin.psi.KtExpression +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 AbstractTypeScopeTest : AbstractAnalysisApiSingleFileTest() { + override fun doTestByFileStructure(ktFile: KtFile, module: TestModule, testServices: TestServices) { + val expression = testServices.expressionMarkerProvider.getSelectedElementOfType(ktFile) + analyseForTest(expression) { + val type = expression.getKtType() + ?: error("expression $expression is not typable") + val typeScope = type.getTypeScope() + val declaredScopeByTypeScope = typeScope?.getDeclarationScope() + + val scopeStringRepresentation = prettyPrint { + appendLine("expression: ${expression.text}") + appendLine("KtType: ${type.render()}") + appendLine() + appendLine("KtTypeScope:") + appendLine(typeScope?.let { renderForTests(it) } ?: "NO_SCOPE") + appendLine() + + appendLine("Declaration Scope:") + appendLine(declaredScopeByTypeScope?.let { renderForTests(it) } ?: "NO_SCOPE") + + } + + val signaturePretty = prettyPrint { + appendLine("KtTypeScope:") + appendLine(typeScope?.let { prettyPrintForTests(it) } ?: "NO_SCOPE") + appendLine() + + appendLine("Declaration Scope:") + appendLine(declaredScopeByTypeScope?.let { prettyPrintForTests(it) } ?: "NO_SCOPE") + } + + testServices.assertions.assertEqualsToTestDataFileSibling(scopeStringRepresentation) + testServices.assertions.assertEqualsToTestDataFileSibling(signaturePretty, extension = ".pretty.txt") + } + } + + private fun KtAnalysisSession.renderForTests(typeScope: KtTypeScope): String { + val callables = typeScope.getCallableSignatures().toList() + return prettyPrint { + callables.forEach { + appendLine(stringRepresentation(it)) + } + } + } + + private fun KtAnalysisSession.prettyPrintForTests(typeScope: KtTypeScope): String { + val callables = typeScope.getCallableSignatures().toList() + return prettyPrint { + callables.forEach { + appendLine(prettyPrintSignature(it)) + } + } + } + + @Suppress("unused") + private fun KtAnalysisSession.renderForTests(scope: KtScope): String { + val callables = scope.getCallableSymbols().toList() + return prettyPrint { + callables.forEach { + appendLine(DebugSymbolRenderer.render(it)) + } + } + } + + private fun KtAnalysisSession.prettyPrintForTests(scope: KtScope): String { + val callables = scope.getCallableSymbols().toList() + return prettyPrint { + callables.forEach { + appendLine(it.render(options = KtDeclarationRendererOptions.DEFAULT.copy(modifiers = RendererModifier.NONE))) + } + } + } + +} diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/scopes/FirStandaloneNormalAnalysisSourceModuleTypeScopeTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/scopes/FirStandaloneNormalAnalysisSourceModuleTypeScopeTestGenerated.java new file mode 100644 index 00000000000..560dcf503f6 --- /dev/null +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/scopes/FirStandaloneNormalAnalysisSourceModuleTypeScopeTestGenerated.java @@ -0,0 +1,84 @@ +/* + * Copyright 2010-2021 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.AbstractTypeScopeTest; +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 GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("analysis/analysis-api/testData/components/scopeProvider/typeScope") +@TestDataPath("$PROJECT_ROOT") +public class FirStandaloneNormalAnalysisSourceModuleTypeScopeTestGenerated extends AbstractTypeScopeTest { + @NotNull + @Override + public AnalysisApiTestConfigurator getConfigurator() { + return AnalysisApiFirStandaloneModeTestConfiguratorFactory.INSTANCE.createConfigurator( + new AnalysisApiTestConfiguratorFactoryData( + FrontendKind.Fir, + TestModuleKind.Source, + AnalysisSessionMode.Normal, + AnalysisApiMode.Standalone + ) + ); + } + + @Test + public void testAllFilesPresentInTypeScope() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/scopeProvider/typeScope"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("errorType.kt") + public void testErrorType() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.kt"); + } + + @Test + @TestMetadata("innerClassTypeParamsSubstitution.kt") + public void testInnerClassTypeParamsSubstitution() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt"); + } + + @Test + @TestMetadata("intList.kt") + public void testIntList() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.kt"); + } + + @Test + @TestMetadata("outerClassTypeParamsSubstitution.kt") + public void testOuterClassTypeParamsSubstitution() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.kt"); + } + + @Test + @TestMetadata("outerTypeParamsSubstitution.kt") + public void testOuterTypeParamsSubstitution() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.kt"); + } + + @Test + @TestMetadata("typeParamList.kt") + public void testTypeParamList() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.kt"); + } +} diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.kt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.kt new file mode 100644 index 00000000000..ccfa0fa61d7 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.kt @@ -0,0 +1,4 @@ + +fun foo(o: AAA) { + println(o) +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.pretty.txt new file mode 100644 index 00000000000..a74d8eba806 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.pretty.txt @@ -0,0 +1,5 @@ +KtTypeScope: +NO_SCOPE + +Declaration Scope: +NO_SCOPE diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.txt new file mode 100644 index 00000000000..ad3d1725d03 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/errorType.txt @@ -0,0 +1,8 @@ +expression: o +KtType: AAA + +KtTypeScope: +NO_SCOPE + +Declaration Scope: +NO_SCOPE diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt new file mode 100644 index 00000000000..6d296df37fb --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt @@ -0,0 +1,12 @@ +class Outer { + inner class A { + fun foo(x: X, y: Y): Map> + + val map: Map + } +} + +fun foo(o: Outer) { + val a = o.A() + println(a) +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.pretty.txt new file mode 100644 index 00000000000..2823c59576d --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.pretty.txt @@ -0,0 +1,15 @@ +KtTypeScope: +fun foo(x: kotlin.Int, y: Y): kotlin.collections.Map> +val map: kotlin.collections.Map +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + + +Declaration Scope: +fun foo(x: X, y: Y): kotlin.collections.Map> +val map: kotlin.collections.Map +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.txt new file mode 100644 index 00000000000..ca1fd63f0d8 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.txt @@ -0,0 +1,178 @@ +expression: a +KtType: Outer.A + +KtTypeScope: +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.Map> + symbol = /Outer.A.foo(: Outer.A, x: X, y: Y): kotlin.collections.Map> + valueParameters = [ + KtVariableLikeSignature: + name = x + receiverType = null + returnType = kotlin.Int + symbol = x: X + callableIdIfNonLocal = null, + KtVariableLikeSignature: + name = y + receiverType = null + returnType = Y + symbol = y: Y + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = /Outer.A.foo +KtVariableLikeSignature: + name = map + receiverType = null + returnType = kotlin.collections.Map + symbol = val map: kotlin.collections.Map + callableIdIfNonLocal = /Outer.A.map +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/Any.equals(: kotlin.Any, other: kotlin.Any?): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = other + receiverType = null + returnType = kotlin.Any? + symbol = other: kotlin.Any? + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/Any.equals +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Any.hashCode(: kotlin.Any): kotlin.Int + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.hashCode +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = kotlin/Any.toString(: kotlin.Any): kotlin.String + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.toString + + +Declaration Scope: +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: /Outer.A.foo + 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 + receiverType: null + returnType: kotlin/collections/Map> + symbolKind: CLASS_MEMBER + typeParameters: [ + KtTypeParameterSymbol(Y) + ] + valueParameters: [ + KtValueParameterSymbol(x) + KtValueParameterSymbol(y) + ] + visibility: Public +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /Outer.A.map + getter: KtPropertyGetterSymbol() + 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: map + origin: SOURCE + receiverType: null + returnType: kotlin/collections/Map + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.equals + 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 + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(other) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.hashCode + 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 + receiverType: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.toString + 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 + receiverType: null + returnType: kotlin/String + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.kt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.kt new file mode 100644 index 00000000000..d3126906b9c --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.kt @@ -0,0 +1,3 @@ +fun (list: List) { + println(list) +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.pretty.txt new file mode 100644 index 00000000000..44388a5323c --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.pretty.txt @@ -0,0 +1,33 @@ +KtTypeScope: +fun contains(element: kotlin.Int): kotlin.Boolean +fun containsAll(elements: kotlin.collections.Collection): kotlin.Boolean +fun get(index: kotlin.Int): kotlin.Int +fun indexOf(element: kotlin.Int): kotlin.Int +fun isEmpty(): kotlin.Boolean +fun iterator(): kotlin.collections.Iterator +fun lastIndexOf(element: kotlin.Int): kotlin.Int +fun listIterator(): kotlin.collections.ListIterator +fun listIterator(index: kotlin.Int): kotlin.collections.ListIterator +fun subList(fromIndex: kotlin.Int, toIndex: kotlin.Int): kotlin.collections.List +val size: kotlin.Int +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + + +Declaration Scope: +fun contains(element: E): kotlin.Boolean +fun containsAll(elements: kotlin.collections.Collection): kotlin.Boolean +fun get(index: kotlin.Int): E +fun indexOf(element: E): kotlin.Int +fun isEmpty(): kotlin.Boolean +fun iterator(): kotlin.collections.Iterator +fun lastIndexOf(element: E): kotlin.Int +fun listIterator(): kotlin.collections.ListIterator +fun listIterator(index: kotlin.Int): kotlin.collections.ListIterator +fun subList(fromIndex: kotlin.Int, toIndex: kotlin.Int): kotlin.collections.List +val size: kotlin.Int +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.txt new file mode 100644 index 00000000000..2ae97044b51 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/intList.txt @@ -0,0 +1,482 @@ +expression: list +KtType: kotlin.collections.List + +KtTypeScope: +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/collections/List.contains(: kotlin.collections.List, element: E): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = element + receiverType = null + returnType = kotlin.Int + symbol = element: E + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.contains +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/collections/List.containsAll(: kotlin.collections.List, elements: kotlin.collections.Collection): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = elements + receiverType = null + returnType = kotlin.collections.Collection + symbol = elements: kotlin.collections.Collection + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.containsAll +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/collections/List.get(: kotlin.collections.List, index: kotlin.Int): E + valueParameters = [ + KtVariableLikeSignature: + name = index + receiverType = null + returnType = kotlin.Int + symbol = index: kotlin.Int + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.get +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/collections/List.indexOf(: kotlin.collections.List, element: E): kotlin.Int + valueParameters = [ + KtVariableLikeSignature: + name = element + receiverType = null + returnType = kotlin.Int + symbol = element: E + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.indexOf +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/collections/List.isEmpty(: kotlin.collections.List): kotlin.Boolean + valueParameters = [] + callableIdIfNonLocal = kotlin/collections/List.isEmpty +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.Iterator + symbol = kotlin/collections/List.iterator(: kotlin.collections.List): kotlin.collections.Iterator + valueParameters = [] + callableIdIfNonLocal = kotlin/collections/List.iterator +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/collections/List.lastIndexOf(: kotlin.collections.List, element: E): kotlin.Int + valueParameters = [ + KtVariableLikeSignature: + name = element + receiverType = null + returnType = kotlin.Int + symbol = element: E + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.lastIndexOf +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.ListIterator + symbol = kotlin/collections/List.listIterator(: kotlin.collections.List): kotlin.collections.ListIterator + valueParameters = [] + callableIdIfNonLocal = kotlin/collections/List.listIterator +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.ListIterator + symbol = kotlin/collections/List.listIterator(: kotlin.collections.List, index: kotlin.Int): kotlin.collections.ListIterator + valueParameters = [ + KtVariableLikeSignature: + name = index + receiverType = null + returnType = kotlin.Int + symbol = index: kotlin.Int + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.listIterator +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.List + symbol = kotlin/collections/List.subList(: kotlin.collections.List, fromIndex: kotlin.Int, toIndex: kotlin.Int): kotlin.collections.List + valueParameters = [ + KtVariableLikeSignature: + name = fromIndex + receiverType = null + returnType = kotlin.Int + symbol = fromIndex: kotlin.Int + callableIdIfNonLocal = null, + KtVariableLikeSignature: + name = toIndex + receiverType = null + returnType = kotlin.Int + symbol = toIndex: kotlin.Int + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.subList +KtVariableLikeSignature: + name = size + receiverType = null + returnType = kotlin.Int + symbol = val size: kotlin.Int + callableIdIfNonLocal = kotlin/collections/List.size +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/Any.equals(: kotlin.Any, other: kotlin.Any?): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = other + receiverType = null + returnType = kotlin.Any? + symbol = other: kotlin.Any? + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/Any.equals +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Any.hashCode(: kotlin.Any): kotlin.Int + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.hashCode +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = kotlin/Any.toString(: kotlin.Any): kotlin.String + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.toString + + +Declaration Scope: +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.contains + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: contains + origin: LIBRARY + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(element) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.containsAll + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: containsAll + origin: LIBRARY + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(elements) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.get + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: get + origin: LIBRARY + receiverType: null + returnType: E + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(index) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.indexOf + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: indexOf + origin: LIBRARY + receiverType: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(element) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.isEmpty + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: isEmpty + origin: LIBRARY + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.iterator + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: iterator + origin: LIBRARY + receiverType: null + returnType: kotlin/collections/Iterator + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.lastIndexOf + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: lastIndexOf + origin: LIBRARY + receiverType: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(element) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.listIterator + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: listIterator + origin: LIBRARY + receiverType: null + returnType: kotlin/collections/ListIterator + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.listIterator + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: listIterator + origin: LIBRARY + receiverType: null + returnType: kotlin/collections/ListIterator + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(index) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.subList + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: subList + origin: LIBRARY + receiverType: null + returnType: kotlin/collections/List + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(fromIndex) + KtValueParameterSymbol(toIndex) + ] + visibility: Public +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.size + getter: KtPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: ABSTRACT + name: size + origin: LIBRARY + receiverType: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.equals + 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 + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(other) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.hashCode + 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 + receiverType: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.toString + 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 + receiverType: null + returnType: kotlin/String + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.kt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.kt new file mode 100644 index 00000000000..b3c48d1b6ac --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.kt @@ -0,0 +1,11 @@ +class Outer { + class A { + fun foo(x: X, y: Y): Map> + + val map: Map + } +} + +fun foo(a: Outer.A) { + println(a) +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.pretty.txt new file mode 100644 index 00000000000..9dec9c0a010 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.pretty.txt @@ -0,0 +1,15 @@ +KtTypeScope: +fun foo(x: kotlin.Int, y: Y): kotlin.collections.Map> +val map: kotlin.collections.Map +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + + +Declaration Scope: +fun foo(x: X, y: Y): kotlin.collections.Map> +val map: kotlin.collections.Map +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.txt new file mode 100644 index 00000000000..2cd7b41338f --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerClassTypeParamsSubstitution.txt @@ -0,0 +1,178 @@ +expression: a +KtType: Outer.A + +KtTypeScope: +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.Map> + symbol = /Outer.A.foo(: Outer.A, x: X, y: Y): kotlin.collections.Map> + valueParameters = [ + KtVariableLikeSignature: + name = x + receiverType = null + returnType = kotlin.Int + symbol = x: X + callableIdIfNonLocal = null, + KtVariableLikeSignature: + name = y + receiverType = null + returnType = Y + symbol = y: Y + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = /Outer.A.foo +KtVariableLikeSignature: + name = map + receiverType = null + returnType = kotlin.collections.Map + symbol = val map: kotlin.collections.Map + callableIdIfNonLocal = /Outer.A.map +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/Any.equals(: kotlin.Any, other: kotlin.Any?): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = other + receiverType = null + returnType = kotlin.Any? + symbol = other: kotlin.Any? + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/Any.equals +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Any.hashCode(: kotlin.Any): kotlin.Int + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.hashCode +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = kotlin/Any.toString(: kotlin.Any): kotlin.String + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.toString + + +Declaration Scope: +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: /Outer.A.foo + 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 + receiverType: null + returnType: kotlin/collections/Map> + symbolKind: CLASS_MEMBER + typeParameters: [ + KtTypeParameterSymbol(Y) + ] + valueParameters: [ + KtValueParameterSymbol(x) + KtValueParameterSymbol(y) + ] + visibility: Public +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /Outer.A.map + getter: KtPropertyGetterSymbol() + 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: map + origin: SOURCE + receiverType: null + returnType: kotlin/collections/Map + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.equals + 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 + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(other) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.hashCode + 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 + receiverType: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.toString + 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 + receiverType: null + returnType: kotlin/String + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.kt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.kt new file mode 100644 index 00000000000..878522b0ecb --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.kt @@ -0,0 +1,9 @@ +class A { + fun foo(x: X, y: Y): Map + + val map: Map +} + +fun foo(a: A) { + println(a) +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.pretty.txt new file mode 100644 index 00000000000..19ab20b8ae2 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.pretty.txt @@ -0,0 +1,15 @@ +KtTypeScope: +fun foo(x: kotlin.Int, y: Y): kotlin.collections.Map +val map: kotlin.collections.Map +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + + +Declaration Scope: +fun foo(x: X, y: Y): kotlin.collections.Map +val map: kotlin.collections.Map +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.txt new file mode 100644 index 00000000000..d182108b411 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.txt @@ -0,0 +1,178 @@ +expression: a +KtType: A + +KtTypeScope: +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.Map + symbol = /A.foo(: A, x: X, y: Y): kotlin.collections.Map + valueParameters = [ + KtVariableLikeSignature: + name = x + receiverType = null + returnType = kotlin.Int + symbol = x: X + callableIdIfNonLocal = null, + KtVariableLikeSignature: + name = y + receiverType = null + returnType = Y + symbol = y: Y + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = /A.foo +KtVariableLikeSignature: + name = map + receiverType = null + returnType = kotlin.collections.Map + symbol = val map: kotlin.collections.Map + callableIdIfNonLocal = /A.map +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/Any.equals(: kotlin.Any, other: kotlin.Any?): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = other + receiverType = null + returnType = kotlin.Any? + symbol = other: kotlin.Any? + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/Any.equals +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Any.hashCode(: kotlin.Any): kotlin.Int + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.hashCode +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = kotlin/Any.toString(: kotlin.Any): kotlin.String + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.toString + + +Declaration Scope: +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: /A.foo + 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 + receiverType: null + returnType: kotlin/collections/Map + symbolKind: CLASS_MEMBER + typeParameters: [ + KtTypeParameterSymbol(Y) + ] + valueParameters: [ + KtValueParameterSymbol(x) + KtValueParameterSymbol(y) + ] + visibility: Public +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /A.map + getter: KtPropertyGetterSymbol() + 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: map + origin: SOURCE + receiverType: null + returnType: kotlin/collections/Map + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.equals + 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 + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(other) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.hashCode + 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 + receiverType: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.toString + 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 + receiverType: null + returnType: kotlin/String + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.kt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.kt new file mode 100644 index 00000000000..485d7016a65 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.kt @@ -0,0 +1,3 @@ +fun (list: List) { + println(list) +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.pretty.txt new file mode 100644 index 00000000000..b119d9ea763 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.pretty.txt @@ -0,0 +1,33 @@ +KtTypeScope: +fun contains(element: AAA): kotlin.Boolean +fun containsAll(elements: kotlin.collections.Collection): kotlin.Boolean +fun get(index: kotlin.Int): AAA +fun indexOf(element: AAA): kotlin.Int +fun isEmpty(): kotlin.Boolean +fun iterator(): kotlin.collections.Iterator +fun lastIndexOf(element: AAA): kotlin.Int +fun listIterator(): kotlin.collections.ListIterator +fun listIterator(index: kotlin.Int): kotlin.collections.ListIterator +fun subList(fromIndex: kotlin.Int, toIndex: kotlin.Int): kotlin.collections.List +val size: kotlin.Int +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + + +Declaration Scope: +fun contains(element: E): kotlin.Boolean +fun containsAll(elements: kotlin.collections.Collection): kotlin.Boolean +fun get(index: kotlin.Int): E +fun indexOf(element: E): kotlin.Int +fun isEmpty(): kotlin.Boolean +fun iterator(): kotlin.collections.Iterator +fun lastIndexOf(element: E): kotlin.Int +fun listIterator(): kotlin.collections.ListIterator +fun listIterator(index: kotlin.Int): kotlin.collections.ListIterator +fun subList(fromIndex: kotlin.Int, toIndex: kotlin.Int): kotlin.collections.List +val size: kotlin.Int +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.txt new file mode 100644 index 00000000000..2d4ab62ca37 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/typeParamList.txt @@ -0,0 +1,482 @@ +expression: list +KtType: kotlin.collections.List + +KtTypeScope: +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/collections/List.contains(: kotlin.collections.List, element: E): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = element + receiverType = null + returnType = AAA + symbol = element: E + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.contains +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/collections/List.containsAll(: kotlin.collections.List, elements: kotlin.collections.Collection): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = elements + receiverType = null + returnType = kotlin.collections.Collection + symbol = elements: kotlin.collections.Collection + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.containsAll +KtFunctionLikeSignature: + receiverType = null + returnType = AAA + symbol = kotlin/collections/List.get(: kotlin.collections.List, index: kotlin.Int): E + valueParameters = [ + KtVariableLikeSignature: + name = index + receiverType = null + returnType = kotlin.Int + symbol = index: kotlin.Int + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.get +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/collections/List.indexOf(: kotlin.collections.List, element: E): kotlin.Int + valueParameters = [ + KtVariableLikeSignature: + name = element + receiverType = null + returnType = AAA + symbol = element: E + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.indexOf +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/collections/List.isEmpty(: kotlin.collections.List): kotlin.Boolean + valueParameters = [] + callableIdIfNonLocal = kotlin/collections/List.isEmpty +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.Iterator + symbol = kotlin/collections/List.iterator(: kotlin.collections.List): kotlin.collections.Iterator + valueParameters = [] + callableIdIfNonLocal = kotlin/collections/List.iterator +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/collections/List.lastIndexOf(: kotlin.collections.List, element: E): kotlin.Int + valueParameters = [ + KtVariableLikeSignature: + name = element + receiverType = null + returnType = AAA + symbol = element: E + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.lastIndexOf +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.ListIterator + symbol = kotlin/collections/List.listIterator(: kotlin.collections.List): kotlin.collections.ListIterator + valueParameters = [] + callableIdIfNonLocal = kotlin/collections/List.listIterator +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.ListIterator + symbol = kotlin/collections/List.listIterator(: kotlin.collections.List, index: kotlin.Int): kotlin.collections.ListIterator + valueParameters = [ + KtVariableLikeSignature: + name = index + receiverType = null + returnType = kotlin.Int + symbol = index: kotlin.Int + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.listIterator +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.collections.List + symbol = kotlin/collections/List.subList(: kotlin.collections.List, fromIndex: kotlin.Int, toIndex: kotlin.Int): kotlin.collections.List + valueParameters = [ + KtVariableLikeSignature: + name = fromIndex + receiverType = null + returnType = kotlin.Int + symbol = fromIndex: kotlin.Int + callableIdIfNonLocal = null, + KtVariableLikeSignature: + name = toIndex + receiverType = null + returnType = kotlin.Int + symbol = toIndex: kotlin.Int + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/collections/List.subList +KtVariableLikeSignature: + name = size + receiverType = null + returnType = kotlin.Int + symbol = val size: kotlin.Int + callableIdIfNonLocal = kotlin/collections/List.size +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/Any.equals(: kotlin.Any, other: kotlin.Any?): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = other + receiverType = null + returnType = kotlin.Any? + symbol = other: kotlin.Any? + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/Any.equals +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Any.hashCode(: kotlin.Any): kotlin.Int + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.hashCode +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = kotlin/Any.toString(: kotlin.Any): kotlin.String + valueParameters = [] + callableIdIfNonLocal = kotlin/Any.toString + + +Declaration Scope: +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.contains + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: contains + origin: LIBRARY + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(element) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.containsAll + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: containsAll + origin: LIBRARY + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(elements) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.get + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: get + origin: LIBRARY + receiverType: null + returnType: E + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(index) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.indexOf + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: indexOf + origin: LIBRARY + receiverType: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(element) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.isEmpty + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: isEmpty + origin: LIBRARY + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.iterator + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: iterator + origin: LIBRARY + receiverType: null + returnType: kotlin/collections/Iterator + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.lastIndexOf + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: lastIndexOf + origin: LIBRARY + receiverType: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(element) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.listIterator + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: listIterator + origin: LIBRARY + receiverType: null + returnType: kotlin/collections/ListIterator + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.listIterator + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: listIterator + origin: LIBRARY + receiverType: null + returnType: kotlin/collections/ListIterator + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(index) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.subList + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: subList + origin: LIBRARY + receiverType: null + returnType: kotlin/collections/List + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(fromIndex) + KtValueParameterSymbol(toIndex) + ] + visibility: Public +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/collections/List.size + getter: KtPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: ABSTRACT + name: size + origin: LIBRARY + receiverType: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.equals + 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 + receiverType: null + returnType: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol(other) + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.hashCode + 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 + receiverType: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Any.toString + 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 + receiverType: null + returnType: kotlin/String + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + diff --git a/analysis/analysis-test-framework/tests/org/jetbrains/kotlin/analysis/test/framework/services/ExpressionMarkersSourceFilePreprocessor.kt b/analysis/analysis-test-framework/tests/org/jetbrains/kotlin/analysis/test/framework/services/ExpressionMarkersSourceFilePreprocessor.kt index 136477cd65d..e005ac4c3de 100644 --- a/analysis/analysis-test-framework/tests/org/jetbrains/kotlin/analysis/test/framework/services/ExpressionMarkersSourceFilePreprocessor.kt +++ b/analysis/analysis-test-framework/tests/org/jetbrains/kotlin/analysis/test/framework/services/ExpressionMarkersSourceFilePreprocessor.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.test.model.TestFile import org.jetbrains.kotlin.test.services.SourceFilePreprocessor import org.jetbrains.kotlin.test.services.TestService import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance internal class ExpressionMarkersSourceFilePreprocessor(testServices: TestServices) : SourceFilePreprocessor(testServices) { override fun process(file: TestFile, content: String): String { @@ -102,6 +103,15 @@ class ExpressionMarkerProvider : TestService { return elements.single() as KtElement } + inline fun getSelectedElementOfType(file: KtFile): E { + return when (val selected = getSelectedElement(file)) { + is E -> selected + else -> generateSequence(selected as PsiElement) { current -> + current.children.singleOrNull()?.takeIf { it.textRange == current.textRange } + }.firstIsInstance() + } + } + private fun List.trimWhitespaces(): List = dropWhile { it is PsiWhiteSpace } .dropLastWhile { it is PsiWhiteSpace } diff --git a/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/analysisApi.kt b/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/analysisApi.kt index badd43532a7..c3350db46cd 100644 --- a/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/analysisApi.kt +++ b/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/analysisApi.kt @@ -35,10 +35,7 @@ import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typeInf import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typeProvider.AbstractAnalysisApiGetSuperTypesTest import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typeProvider.AbstractHasCommonSubtypeTest import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references.AbstractReferenceResolveTest -import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.scopes.AbstractDelegateMemberScopeTest -import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.scopes.AbstractFileScopeTest -import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.scopes.AbstractMemberScopeByFqNameTest -import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.scopes.AbstractSubstitutionOverridesUnwrappingTest +import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.scopes.* import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.AbstractSymbolByFqNameTest import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.AbstractSymbolByPsiTest import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.AbstractSymbolByReferenceTest @@ -289,4 +286,12 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() { } } } + + component("scopeProvider") { + group(filter = frontendIs(FrontendKind.Fir)) { + test(AbstractTypeScopeTest::class) { + model("typeScope") + } + } + } }