Analysis API: Get argument mapping from candidate and type parameters

from candidate symbol.
This commit is contained in:
Mark Punzalan
2022-01-31 17:58:28 +00:00
committed by Ilya Kirillov
parent 0ed802bca4
commit ace826c570
19 changed files with 887 additions and 14 deletions
@@ -0,0 +1,7 @@
fun function(a: Char) {}
fun function(b: Boolean) {}
fun function(c: String) {}
fun call() {
<expr>function(1)</expr>
}
@@ -0,0 +1,77 @@
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(a: kotlin.Char): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Char
symbol = a: kotlin.Char
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Char
symbol = a: kotlin.Char)
}
]
diagnostic = ERROR<ARGUMENT_TYPE_MISMATCH: Argument type mismatch: actual type is kotlin/Int but kotlin/Char was expected>
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(b: kotlin.Boolean): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = b: kotlin.Boolean
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = b: kotlin.Boolean)
}
]
diagnostic = ERROR<ARGUMENT_TYPE_MISMATCH: Argument type mismatch: actual type is kotlin/Int but kotlin/Boolean was expected>
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(c: kotlin.String): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.String
symbol = c: kotlin.String
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
receiverType = null
returnType = kotlin.String
symbol = c: kotlin.String)
}
]
diagnostic = ERROR<ARGUMENT_TYPE_MISMATCH: Argument type mismatch: actual type is kotlin/Int but kotlin/String was expected>
@@ -0,0 +1,7 @@
fun <T> function(t: T, a: Char) {}
fun <U> function(u: U, b: Boolean) {}
fun <V> function(v: V, c: String) {}
fun call() {
<expr>function<Int>(1)</expr>
}
@@ -0,0 +1,89 @@
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(t: T, a: kotlin.Char): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Int
symbol = t: T,
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Char
symbol = a: kotlin.Char
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Int
symbol = t: T)
}
]
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'a'>
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(u: U, b: kotlin.Boolean): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Int
symbol = u: U,
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = b: kotlin.Boolean
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Int
symbol = u: U)
}
]
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'b'>
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(v: V, c: kotlin.String): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Int
symbol = v: V,
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.String
symbol = c: kotlin.String
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Int
symbol = v: V)
}
]
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'c'>
@@ -0,0 +1,7 @@
fun <T> function(t: T, a: Char) {}
fun <U> function(u: U, b: Boolean) {}
fun <V> function(v: V, c: String) {}
fun call() {
<expr>function(1)</expr>
}
@@ -0,0 +1,89 @@
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(t: T, a: kotlin.Char): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
receiverType = null
returnType = T
symbol = t: T,
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Char
symbol = a: kotlin.Char
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
receiverType = null
returnType = T
symbol = t: T)
}
]
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'a'>
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(u: U, b: kotlin.Boolean): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
receiverType = null
returnType = U
symbol = u: U,
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = b: kotlin.Boolean
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
receiverType = null
returnType = U
symbol = u: U)
}
]
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'b'>
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(v: V, c: kotlin.String): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
receiverType = null
returnType = V
symbol = v: V,
KtVariableLikeSignature:
receiverType = null
returnType = kotlin.String
symbol = c: kotlin.String
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
receiverType = null
returnType = V
symbol = v: V)
}
]
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'c'>