Analysis API: Implement KtCallResolver.collectAllCandidates for FE 1.0.

This commit is contained in:
Mark Punzalan
2022-02-14 07:11:56 +00:00
committed by Ilya Kirillov
parent 81a66258fa
commit afb34d3193
28 changed files with 1393 additions and 31 deletions
@@ -0,0 +1,28 @@
KtApplicableCallCandidateInfo:
candidate = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtImplicitReceiverValue:
symbol = KtReceiverParameterSymbol:
origin: SOURCE
type: test/Target<kotlin/String>
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = test/Target.add(<dispatch receiver>: test.Target<T>, t: T): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = t
receiverType = null
returnType = kotlin.String
symbol = t: T
]
argumentMapping = {
s -> (KtVariableLikeSignature:
name = t
receiverType = null
returnType = kotlin.String
symbol = t: T)
}
isInBestCandidates = true
@@ -0,0 +1,49 @@
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Int but Double was expected>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = i
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Double
returnType = kotlin.Unit
symbol = /invoke(<extension receiver>: kotlin.Double): kotlin.Unit
valueParameters = []
argumentMapping = {}
isInBestCandidates = false
KtApplicableCallCandidateInfo:
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = i
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Int
returnType = kotlin.Long
symbol = /invoke(<extension receiver>: kotlin.Int): kotlin.Long
valueParameters = []
argumentMapping = {}
isInBestCandidates = true
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Int but Long was expected>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = i
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Long
returnType = kotlin.Double
symbol = /invoke(<extension receiver>: kotlin.Long): kotlin.Double
valueParameters = []
argumentMapping = {}
isInBestCandidates = false
@@ -0,0 +1,49 @@
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Long but Double was expected>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = i()
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Double
returnType = kotlin.Unit
symbol = /invoke(<extension receiver>: kotlin.Double): kotlin.Unit
valueParameters = []
argumentMapping = {}
isInBestCandidates = false
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Long but Int was expected>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = i()
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Int
returnType = kotlin.Long
symbol = /invoke(<extension receiver>: kotlin.Int): kotlin.Long
valueParameters = []
argumentMapping = {}
isInBestCandidates = false
KtApplicableCallCandidateInfo:
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = i()
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Long
returnType = kotlin.Double
symbol = /invoke(<extension receiver>: kotlin.Long): kotlin.Double
valueParameters = []
argumentMapping = {}
isInBestCandidates = true
@@ -0,0 +1,49 @@
KtApplicableCallCandidateInfo:
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = i()()
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Double
returnType = kotlin.Unit
symbol = /invoke(<extension receiver>: kotlin.Double): kotlin.Unit
valueParameters = []
argumentMapping = {}
isInBestCandidates = true
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Double but Int was expected>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = i()()
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Int
returnType = kotlin.Long
symbol = /invoke(<extension receiver>: kotlin.Int): kotlin.Long
valueParameters = []
argumentMapping = {}
isInBestCandidates = false
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Double but Long was expected>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = i()()
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Long
returnType = kotlin.Double
symbol = /invoke(<extension receiver>: kotlin.Long): kotlin.Double
valueParameters = []
argumentMapping = {}
isInBestCandidates = false
@@ -0,0 +1,17 @@
KtApplicableCallCandidateInfo:
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = f
isSafeNavigation = false
extensionReceiver = KtExplicitReceiverValue:
expression = ""
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.String
returnType = kotlin.Unit
symbol = kotlin/Function1.invoke(<extension receiver>: P1<dispatch receiver>: kotlin.Function1<P1, R>): R
valueParameters = []
argumentMapping = {}
isInBestCandidates = true
@@ -0,0 +1,17 @@
KtApplicableCallCandidateInfo:
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = f
isSafeNavigation = false
extensionReceiver = KtExplicitReceiverValue:
expression = ""
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.String
returnType = kotlin.Unit
symbol = kotlin/Function1.invoke(<extension receiver>: P1<dispatch receiver>: kotlin.Function1<P1, R>): R
valueParameters = []
argumentMapping = {}
isInBestCandidates = true
@@ -0,0 +1,38 @@
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<TOO_MANY_ARGUMENTS: Too many arguments for public final operator fun get(a: Int, b: String): Boolean defined in C>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = c
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = /C.get(<dispatch receiver>: C, a: kotlin.Int, b: kotlin.String): kotlin.Boolean
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: kotlin.String
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int),
"foo" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: kotlin.String)
}
isInBestCandidates = true
@@ -0,0 +1,48 @@
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<CONSTANT_EXPECTED_TYPE_MISMATCH: The floating-point literal does not conform to the expected type Boolean>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = c
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /C.set(<dispatch receiver>: C, a: kotlin.Int, b: kotlin.String, value: kotlin.Boolean): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: kotlin.String,
KtVariableLikeSignature:
name = value
receiverType = null
returnType = kotlin.Boolean
symbol = value: kotlin.Boolean
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int),
"foo" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: kotlin.String),
3.14 -> (KtVariableLikeSignature:
name = value
receiverType = null
returnType = kotlin.Boolean
symbol = value: kotlin.Boolean)
}
isInBestCandidates = true
@@ -0,0 +1,16 @@
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<INVISIBLE_MEMBER: Cannot access 'foo': it is private in 'A'>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = a
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /A.foo(<dispatch receiver>: A): kotlin.Unit
valueParameters = []
argumentMapping = {}
isInBestCandidates = true
@@ -0,0 +1,14 @@
KtInapplicableCallCandidateInfo:
diagnostic = ERROR<TOO_MANY_ARGUMENTS: Too many arguments for public fun foo(): Unit defined in root package in file simpleCallWithNonMatchingArgs.kt>
candidate = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /foo(): kotlin.Unit
valueParameters = []
argumentMapping = {}
isInBestCandidates = true
@@ -0,0 +1,37 @@
KtApplicableCallCandidateInfo:
candidate = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = x
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = kotlin/Function2.invoke(<dispatch receiver>: kotlin.Function2<P1, P2, R>, p1: P1, p2: P2): R
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int
symbol = p1: P1,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(b)) @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String
symbol = p2: P2
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int
symbol = p1: P1),
"" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(b)) @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String
symbol = p2: P2)
}
isInBestCandidates = true