Analysis API: Add tests for KtCallResolver.resolveCandidates().
This commit is contained in:
committed by
Ilya Kirillov
parent
f62bdf5826
commit
0ed802bca4
+3
@@ -0,0 +1,3 @@
|
||||
fun call() {
|
||||
<expr>function(1)</expr>
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
NO_CANDIDATES
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun function(a: Int) {}
|
||||
|
||||
fun call() {
|
||||
<expr>function(1)</expr>
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /function(a: kotlin.Int): kotlin.Unit
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = a
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = a: kotlin.Int
|
||||
]
|
||||
argumentMapping = {
|
||||
1 -> (KtVariableLikeSignature:
|
||||
name = a
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = a: kotlin.Int)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun function(a: Int, b: String) {}
|
||||
|
||||
fun call() {
|
||||
<expr>function(1)</expr>
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
KtErrorCallInfo:
|
||||
candidateCalls = [
|
||||
KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /function(a: kotlin.Int, b: kotlin.String): 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
|
||||
]
|
||||
argumentMapping = {
|
||||
1 -> (KtVariableLikeSignature:
|
||||
name = a
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = a: kotlin.Int)
|
||||
}
|
||||
]
|
||||
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'b'>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
operator fun get(a: Int, b: String): Boolean = true
|
||||
}
|
||||
|
||||
fun call(c: C) {
|
||||
val res = <expr>c[1, "foo"]</expr>
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
KtSuccessCallInfo:
|
||||
call = 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)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
operator fun get(a: Int, b: String): Boolean = true
|
||||
}
|
||||
|
||||
fun call(c: C) {
|
||||
val res = <expr>c[1]</expr>
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
KtErrorCallInfo:
|
||||
candidateCalls = [
|
||||
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)
|
||||
}
|
||||
]
|
||||
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'b'>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
operator fun set(a: Int, b: String, value: Boolean) {}
|
||||
}
|
||||
|
||||
fun call(c: C) {
|
||||
<expr>c[1, "foo"]</expr> = false
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
KtSuccessCallInfo:
|
||||
call = 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),
|
||||
false -> (KtVariableLikeSignature:
|
||||
name = value
|
||||
receiverType = null
|
||||
returnType = kotlin.Boolean
|
||||
symbol = value: kotlin.Boolean)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
operator fun set(a: Int, b: String, value: Boolean) {}
|
||||
}
|
||||
|
||||
fun call(c: C) {
|
||||
<expr>c[1]</expr> = false
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
KtErrorCallInfo:
|
||||
candidateCalls = [
|
||||
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),
|
||||
false -> (KtVariableLikeSignature:
|
||||
name = value
|
||||
receiverType = null
|
||||
returnType = kotlin.Boolean
|
||||
symbol = value: kotlin.Boolean)
|
||||
}
|
||||
]
|
||||
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'b'>
|
||||
+1
@@ -0,0 +1 @@
|
||||
val c = <expr>Comparator {x: Int, y: Int -> 1}</expr>
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = java.util.Comparator<ft<kotlin.Int, kotlin.Int?>>
|
||||
symbol = java/util/Comparator(function: kotlin.Function2<ft<T, T?>, ft<T, T?>, kotlin.Int>): java.util.Comparator<T>
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = function
|
||||
receiverType = null
|
||||
returnType = kotlin.Function2<ft<kotlin.Int, kotlin.Int?>, ft<kotlin.Int, kotlin.Int?>, kotlin.Int>
|
||||
symbol = function: kotlin.Function2<ft<T, T?>, ft<T, T?>, kotlin.Int>
|
||||
]
|
||||
argumentMapping = {
|
||||
{x: Int, y: Int -> 1} -> (KtVariableLikeSignature:
|
||||
name = function
|
||||
receiverType = null
|
||||
returnType = kotlin.Function2<ft<kotlin.Int, kotlin.Int?>, ft<kotlin.Int, kotlin.Int?>, kotlin.Int>
|
||||
symbol = function: kotlin.Function2<ft<T, T?>, ft<T, T?>, kotlin.Int>)
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun call(x: (Int) -> String) {
|
||||
<expr>x(1)</expr>
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.String
|
||||
symbol = kotlin/Function1.invoke(<dispatch receiver>: kotlin.Function1<P1, R>, p1: P1): R
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = p1
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = p1: P1
|
||||
]
|
||||
argumentMapping = {
|
||||
1 -> (KtVariableLikeSignature:
|
||||
name = p1
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = p1: P1)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
operator fun Int.invoke(): String {}
|
||||
|
||||
fun call(x: kotlin.Int) {
|
||||
<expr>x()</expr>
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = kotlin.Int
|
||||
returnType = kotlin.String
|
||||
symbol = /invoke(<extension receiver>: kotlin.Int): kotlin.String
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
Reference in New Issue
Block a user