[Analysis API] Provide type mapping for callable references
Strictly speaking, callable references are not calls. However, type arguments are still inferred for references, and 'KtCall' is the only place in Analysis API that exposes call-substituted types. ^KT-66485 Fixed
This commit is contained in:
+6
@@ -154,6 +154,7 @@ internal class KtFe10CallResolver(
|
||||
val parentBinaryExpression = psi.parentOfType<KtBinaryExpression>()
|
||||
val lhs = KtPsiUtil.deparenthesize(parentBinaryExpression?.left)
|
||||
val unwrappedPsi = KtPsiUtil.deparenthesize(psi as? KtExpression) ?: psi
|
||||
|
||||
if (parentBinaryExpression != null &&
|
||||
parentBinaryExpression.operationToken == KtTokens.EQ &&
|
||||
(lhs == unwrappedPsi || (lhs as? KtQualifiedExpression)?.selectorExpression == unwrappedPsi) &&
|
||||
@@ -163,6 +164,11 @@ internal class KtFe10CallResolver(
|
||||
// treated as a property read.
|
||||
return resolveCall(parentBinaryExpression)
|
||||
}
|
||||
|
||||
if (psi is KtCallableReferenceExpression) {
|
||||
return resolveCall(psi.callableReference)
|
||||
}
|
||||
|
||||
when (unwrappedPsi) {
|
||||
is KtBinaryExpression -> {
|
||||
handleAsCompoundAssignment(this, unwrappedPsi)?.let { return@with it }
|
||||
|
||||
+124
@@ -1010,6 +1010,130 @@ public class Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated extends A
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class CallableReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInCallableReferences() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationConstructor.kt")
|
||||
public void testAnnotationConstructor() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/annotationConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundMemberExtensionFunction.kt")
|
||||
public void testBoundMemberExtensionFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundMemberExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundMemberFunction.kt")
|
||||
public void testBoundMemberFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundMemberFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundMemberProperty.kt")
|
||||
public void testBoundMemberProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundMemberProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundTopLevelExtensionFunction.kt")
|
||||
public void testBoundTopLevelExtensionFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundTopLevelExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundTopLevelExtensionProperty.kt")
|
||||
public void testBoundTopLevelExtensionProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundTopLevelExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constructor.kt")
|
||||
public void testConstructor() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericParameterType.kt")
|
||||
public void testGenericParameterType() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericParameterType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericParameterTypeGenericConsumer.kt")
|
||||
public void testGenericParameterTypeGenericConsumer() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericParameterTypeGenericConsumer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericReturnType.kt")
|
||||
public void testGenericReturnType() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericReturnType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericReturnTypeGenericConsumer.kt")
|
||||
public void testGenericReturnTypeGenericConsumer() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericReturnTypeGenericConsumer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberExtensionProperty.kt")
|
||||
public void testMemberExtensionProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/memberExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberFunction.kt")
|
||||
public void testMemberFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/memberFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberProperty.kt")
|
||||
public void testMemberProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/memberProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/simple.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelExtensionFunction.kt")
|
||||
public void testTopLevelExtensionFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelExtensionProperty.kt")
|
||||
public void testTopLevelExtensionProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelFunction.kt")
|
||||
public void testTopLevelFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelProperty.kt")
|
||||
public void testTopLevelProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+9
-6
@@ -554,7 +554,9 @@ internal class KtFirCallResolver(
|
||||
KtSimpleVariableAccess.Write(rhs)
|
||||
)
|
||||
}
|
||||
is FirPropertyAccessExpression -> {
|
||||
is FirPropertyAccessExpression, is FirCallableReferenceAccess -> {
|
||||
@Suppress("USELESS_IS_CHECK") // K2 warning suppression, TODO: KT-62472
|
||||
require(fir is FirQualifiedAccessExpression)
|
||||
when (unsubstitutedKtSignature.symbol) {
|
||||
is KtVariableLikeSymbol -> {
|
||||
@Suppress("UNCHECKED_CAST") // safe because of the above check on targetKtSymbol
|
||||
@@ -999,11 +1001,12 @@ internal class KtFirCallResolver(
|
||||
is FirArrayLiteral, is FirEqualityOperatorCall -> {
|
||||
toKtCallInfo(psi, resolveCalleeExpressionOfFunctionCall, resolveFragmentOfCall).toKtCallCandidateInfos()
|
||||
}
|
||||
is FirComparisonExpression -> compareToCall.toKtCallInfo(
|
||||
psi,
|
||||
resolveCalleeExpressionOfFunctionCall,
|
||||
resolveFragmentOfCall
|
||||
).toKtCallCandidateInfos()
|
||||
is FirComparisonExpression -> {
|
||||
compareToCall.toKtCallInfo(psi, resolveCalleeExpressionOfFunctionCall, resolveFragmentOfCall).toKtCallCandidateInfos()
|
||||
}
|
||||
is FirCallableReferenceAccess -> {
|
||||
calleeReference.toKtCallInfo(psi, resolveCalleeExpressionOfFunctionCall, resolveFragmentOfCall).toKtCallCandidateInfos()
|
||||
}
|
||||
is FirResolvedQualifier -> toKtCallCandidateInfos()
|
||||
is FirDelegatedConstructorCall -> collectCallCandidatesForDelegatedConstructorCall(psi, resolveFragmentOfCall)
|
||||
else -> toKtCallInfo(psi, resolveCalleeExpressionOfFunctionCall, resolveFragmentOfCall).toKtCallCandidateInfos()
|
||||
|
||||
+10
@@ -56,6 +56,16 @@ public class FirIdeNormalAnalysisScriptSourceModuleResolveCallTestGenerated exte
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class CallableReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInCallableReferences() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences"), Pattern.compile("^(.+)\\.kts$"), null, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+124
@@ -1010,6 +1010,130 @@ public class FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated extends Ab
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class CallableReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInCallableReferences() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationConstructor.kt")
|
||||
public void testAnnotationConstructor() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/annotationConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundMemberExtensionFunction.kt")
|
||||
public void testBoundMemberExtensionFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundMemberExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundMemberFunction.kt")
|
||||
public void testBoundMemberFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundMemberFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundMemberProperty.kt")
|
||||
public void testBoundMemberProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundMemberProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundTopLevelExtensionFunction.kt")
|
||||
public void testBoundTopLevelExtensionFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundTopLevelExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundTopLevelExtensionProperty.kt")
|
||||
public void testBoundTopLevelExtensionProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundTopLevelExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constructor.kt")
|
||||
public void testConstructor() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericParameterType.kt")
|
||||
public void testGenericParameterType() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericParameterType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericParameterTypeGenericConsumer.kt")
|
||||
public void testGenericParameterTypeGenericConsumer() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericParameterTypeGenericConsumer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericReturnType.kt")
|
||||
public void testGenericReturnType() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericReturnType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericReturnTypeGenericConsumer.kt")
|
||||
public void testGenericReturnTypeGenericConsumer() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericReturnTypeGenericConsumer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberExtensionProperty.kt")
|
||||
public void testMemberExtensionProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/memberExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberFunction.kt")
|
||||
public void testMemberFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/memberFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberProperty.kt")
|
||||
public void testMemberProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/memberProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/simple.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelExtensionFunction.kt")
|
||||
public void testTopLevelExtensionFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelExtensionProperty.kt")
|
||||
public void testTopLevelExtensionProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelFunction.kt")
|
||||
public void testTopLevelFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelProperty.kt")
|
||||
public void testTopLevelProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+1
@@ -54,6 +54,7 @@ abstract class AbstractKtCallResolver : KtCallResolver() {
|
||||
is KtNameReferenceExpression -> true
|
||||
is KtOperationExpression -> true
|
||||
is KtArrayAccessExpression -> true
|
||||
is KtCallableReferenceExpression -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
|
||||
+124
@@ -1010,6 +1010,130 @@ public class FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated ext
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class CallableReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInCallableReferences() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences"), Pattern.compile("^(.+)\\.kt$"), null, true, "withTestCompilerPluginEnabled");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationConstructor.kt")
|
||||
public void testAnnotationConstructor() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/annotationConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundMemberExtensionFunction.kt")
|
||||
public void testBoundMemberExtensionFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundMemberExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundMemberFunction.kt")
|
||||
public void testBoundMemberFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundMemberFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundMemberProperty.kt")
|
||||
public void testBoundMemberProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundMemberProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundTopLevelExtensionFunction.kt")
|
||||
public void testBoundTopLevelExtensionFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundTopLevelExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boundTopLevelExtensionProperty.kt")
|
||||
public void testBoundTopLevelExtensionProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/boundTopLevelExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constructor.kt")
|
||||
public void testConstructor() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericParameterType.kt")
|
||||
public void testGenericParameterType() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericParameterType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericParameterTypeGenericConsumer.kt")
|
||||
public void testGenericParameterTypeGenericConsumer() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericParameterTypeGenericConsumer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericReturnType.kt")
|
||||
public void testGenericReturnType() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericReturnType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericReturnTypeGenericConsumer.kt")
|
||||
public void testGenericReturnTypeGenericConsumer() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/genericReturnTypeGenericConsumer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberExtensionProperty.kt")
|
||||
public void testMemberExtensionProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/memberExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberFunction.kt")
|
||||
public void testMemberFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/memberFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberProperty.kt")
|
||||
public void testMemberProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/memberProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/simple.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelExtensionFunction.kt")
|
||||
public void testTopLevelExtensionFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelExtensionProperty.kt")
|
||||
public void testTopLevelExtensionProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelFunction.kt")
|
||||
public void testTopLevelFunction() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelProperty.kt")
|
||||
public void testTopLevelProperty() {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/topLevelProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
annotation class Anno(val value: String)
|
||||
|
||||
fun test() {
|
||||
// Annotation class cannot be instantiated
|
||||
consume(<expr>::Anno</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (String) -> Any) {}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = Anno
|
||||
symbol = <constructor>(value: kotlin.String): Anno
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = value
|
||||
receiverType = null
|
||||
returnType = kotlin.String
|
||||
symbol = value: kotlin.String
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = null
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
interface Foo {
|
||||
fun Bar.foo(a: Int)
|
||||
}
|
||||
|
||||
interface Bar
|
||||
|
||||
fun test(foo: Foo) {
|
||||
with(foo) {
|
||||
// 'foo' is a member and an extension at the same time.
|
||||
// References to such elements are prohibited.
|
||||
consume(<expr>Bar::foo</expr>)
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(f: (Bar, Int) -> Unit) {}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtImplicitReceiverValue:
|
||||
symbol = KtReceiverParameterSymbol:
|
||||
annotationsList: []
|
||||
origin: SOURCE
|
||||
owningCallableSymbol: KtAnonymousFunctionSymbol(<local>/<no name provided>)
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: Foo
|
||||
type = Foo
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = Bar
|
||||
returnType = kotlin.Unit
|
||||
symbol = /Foo.foo(<extension receiver>: Bar, <dispatch receiver>: Foo, a: kotlin.Int): kotlin.Unit
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = a
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = a: kotlin.Int
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface Foo {
|
||||
fun foo(a: Int)
|
||||
}
|
||||
|
||||
fun test(obj: Foo) {
|
||||
consume(<expr>obj::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (Int) -> Unit) {}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtExplicitReceiverValue:
|
||||
expression = obj
|
||||
isSafeNavigation = false
|
||||
type = Foo
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /Foo.foo(<dispatch receiver>: Foo, a: kotlin.Int): kotlin.Unit
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = a
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = a: kotlin.Int
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Foo {
|
||||
val foo: String
|
||||
get() = ""
|
||||
}
|
||||
|
||||
fun test(obj: Foo) {
|
||||
consume(<expr>obj::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: () -> String) {}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleVariableAccessCall:
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtExplicitReceiverValue:
|
||||
expression = obj
|
||||
isSafeNavigation = false
|
||||
type = Foo
|
||||
extensionReceiver = null
|
||||
signature = KtVariableLikeSignature:
|
||||
name = foo
|
||||
receiverType = null
|
||||
returnType = kotlin.String
|
||||
symbol = val foo: kotlin.String
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
simpleAccess = Read:
|
||||
|
||||
typeArgumentsMapping = {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface Foo
|
||||
|
||||
fun Foo.foo(a: Int) {}
|
||||
|
||||
fun test(obj: Foo) {
|
||||
consume(<expr>obj::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (Int) -> Unit) {}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = obj
|
||||
isSafeNavigation = false
|
||||
type = Foo
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = Foo
|
||||
returnType = kotlin.Unit
|
||||
symbol = /foo(<extension receiver>: Foo, a: kotlin.Int): kotlin.Unit
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = a
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = a: kotlin.Int
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = /foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
interface Foo
|
||||
|
||||
val Foo.foo: String
|
||||
get() = ""
|
||||
|
||||
fun test(obj: Foo) {
|
||||
consume(<expr>obj::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: () -> String) {}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleVariableAccessCall:
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = obj
|
||||
isSafeNavigation = false
|
||||
type = Foo
|
||||
signature = KtVariableLikeSignature:
|
||||
name = foo
|
||||
receiverType = Foo
|
||||
returnType = kotlin.String
|
||||
symbol = val foo: kotlin.String
|
||||
callableIdIfNonLocal = /foo
|
||||
simpleAccess = Read:
|
||||
|
||||
typeArgumentsMapping = {}
|
||||
analysis/analysis-api/testData/components/callResolver/resolveCall/callableReferences/constructor.kt
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
class Foo(val value: String)
|
||||
|
||||
fun test() {
|
||||
consume(<expr>::Foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (String) -> Foo) {}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = Foo
|
||||
symbol = <constructor>(value: kotlin.String): Foo
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = value
|
||||
receiverType = null
|
||||
returnType = kotlin.String
|
||||
symbol = value: kotlin.String
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = null
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface Foo<T> {
|
||||
fun foo(value: T)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
consume(<expr>Foo<Int>::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (Foo<Int>, Int) -> Unit) {}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /Foo.foo(<dispatch receiver>: Foo<T>, value: T): kotlin.Unit
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = value
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = value: T
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface Foo<T> {
|
||||
fun foo(value: T)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
consume(<expr>Foo<Int>::foo</expr>)
|
||||
}
|
||||
|
||||
fun <T> consume(f: (Foo<T>, T) -> Unit) {}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /Foo.foo(<dispatch receiver>: Foo<T>, value: T): kotlin.Unit
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = value
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = value: T
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface Foo<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
fun test() {
|
||||
consume(<expr>Foo<Int>::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (Foo<Int>) -> Int) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = /Foo.foo(<dispatch receiver>: Foo<T>): T
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface Foo<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
fun test() {
|
||||
consume(<expr>Foo<Int>::foo</expr>)
|
||||
}
|
||||
|
||||
fun <T> consume(f: (Foo<T>) -> T) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = /Foo.foo(<dispatch receiver>: Foo<T>): T
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
interface Foo {
|
||||
val Bar.foo: String
|
||||
get() = ""
|
||||
}
|
||||
|
||||
interface Bar
|
||||
|
||||
fun test(foo: Foo) {
|
||||
with(foo) {
|
||||
// 'foo' is a member and an extension at the same time.
|
||||
// References to such elements are prohibited.
|
||||
consume(<expr>Bar::foo</expr>)
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(f: (Bar) -> String) {}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleVariableAccessCall:
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtImplicitReceiverValue:
|
||||
symbol = KtReceiverParameterSymbol:
|
||||
annotationsList: []
|
||||
origin: SOURCE
|
||||
owningCallableSymbol: KtAnonymousFunctionSymbol(<local>/<no name provided>)
|
||||
type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: Foo
|
||||
type = Foo
|
||||
extensionReceiver = null
|
||||
signature = KtVariableLikeSignature:
|
||||
name = foo
|
||||
receiverType = Bar
|
||||
returnType = kotlin.String
|
||||
symbol = val foo: kotlin.String
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
simpleAccess = Read:
|
||||
|
||||
typeArgumentsMapping = {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface Foo {
|
||||
fun foo(a: Int)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
consume(<expr>Foo::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (Foo, Int) -> Unit) {}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /Foo.foo(<dispatch receiver>: Foo, a: kotlin.Int): kotlin.Unit
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = a
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = a: kotlin.Int
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Foo {
|
||||
val foo: String
|
||||
get() = ""
|
||||
}
|
||||
|
||||
fun test() {
|
||||
consume(<expr>Foo::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (Foo) -> String) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleVariableAccessCall:
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtVariableLikeSignature:
|
||||
name = foo
|
||||
receiverType = null
|
||||
returnType = kotlin.String
|
||||
symbol = val foo: kotlin.String
|
||||
callableIdIfNonLocal = /Foo.foo
|
||||
simpleAccess = Read:
|
||||
|
||||
typeArgumentsMapping = {}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
fun foo() {
|
||||
<expr>::foo</expr>
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /foo(): kotlin.Unit
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = /foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface Foo
|
||||
|
||||
fun Foo.foo(a: Int) {}
|
||||
|
||||
fun test(foo: Foo) {
|
||||
consume(<expr>Foo::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (Foo, Int) -> Unit) {}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = Foo
|
||||
returnType = kotlin.Unit
|
||||
symbol = /foo(<extension receiver>: Foo, a: kotlin.Int): kotlin.Unit
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = a
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = a: kotlin.Int
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = /foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
interface Foo
|
||||
|
||||
val Foo.foo: String
|
||||
get() = ""
|
||||
|
||||
fun test() {
|
||||
consume(<expr>Foo::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (Foo) -> String) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleVariableAccessCall:
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtVariableLikeSignature:
|
||||
name = foo
|
||||
receiverType = Foo
|
||||
returnType = kotlin.String
|
||||
symbol = val foo: kotlin.String
|
||||
callableIdIfNonLocal = /foo
|
||||
simpleAccess = Read:
|
||||
|
||||
typeArgumentsMapping = {}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun foo(a: Int) {}
|
||||
|
||||
fun test() {
|
||||
consume(<expr>::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: (Int) -> Unit) {}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /foo(a: kotlin.Int): kotlin.Unit
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = a
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = a: kotlin.Int
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = /foo
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
val foo: String
|
||||
get() = ""
|
||||
|
||||
fun test(foo: Foo) {
|
||||
consume(<expr>::foo</expr>)
|
||||
}
|
||||
|
||||
fun consume(f: () -> String) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleVariableAccessCall:
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtVariableLikeSignature:
|
||||
name = foo
|
||||
receiverType = null
|
||||
returnType = kotlin.String
|
||||
symbol = val foo: kotlin.String
|
||||
callableIdIfNonLocal = /foo
|
||||
simpleAccess = Read:
|
||||
|
||||
typeArgumentsMapping = {}
|
||||
Reference in New Issue
Block a user