Analysis API: Fix issues related to implicit invoke calls:
- Correctly set explicit receiver value. - Restore original function call from FirImplicitFunctionCall (i.e., calls implicitly resolved to `invoke`) to get the correct name for getting all candidates. - Collect candidates at all tower levels. Also make order of candidate calls in tests deterministic.
This commit is contained in:
committed by
Ilya Kirillov
parent
ace826c570
commit
9b9da94a09
+6
@@ -0,0 +1,6 @@
|
||||
operator fun Int.invoke() : Long = 1L
|
||||
operator fun Long.invoke() : Double = 1.0
|
||||
operator fun Double.invoke() {}
|
||||
fun test(i: Int) {
|
||||
<expr>i()</expr>()()
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
KtSuccessCallInfo:
|
||||
call = 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 = {}
|
||||
|
||||
KtErrorCallInfo:
|
||||
candidateCalls = [
|
||||
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 = {}
|
||||
]
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
|
||||
KtErrorCallInfo:
|
||||
candidateCalls = [
|
||||
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 = {}
|
||||
]
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
operator fun Int.invoke() : Long = 1L
|
||||
operator fun Long.invoke() : Double = 1.0
|
||||
operator fun Double.invoke() {}
|
||||
fun test(i: Int) {
|
||||
<expr>i()()</expr>()
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
KtErrorCallInfo:
|
||||
candidateCalls = [
|
||||
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 = {}
|
||||
]
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
|
||||
KtSuccessCallInfo:
|
||||
call = 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 = {}
|
||||
|
||||
KtErrorCallInfo:
|
||||
candidateCalls = [
|
||||
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 = {}
|
||||
]
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
operator fun Int.invoke() : Long = 1L
|
||||
operator fun Long.invoke() : Double = 1.0
|
||||
operator fun Double.invoke() {}
|
||||
fun test(i: Int) {
|
||||
<expr>i()()()</expr>
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
KtErrorCallInfo:
|
||||
candidateCalls = [
|
||||
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 = {}
|
||||
]
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
|
||||
KtErrorCallInfo:
|
||||
candidateCalls = [
|
||||
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 = {}
|
||||
]
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
|
||||
KtSuccessCallInfo:
|
||||
call = 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 = {}
|
||||
+3
-1
@@ -2,7 +2,9 @@ KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
dispatchReceiver = KtExplicitReceiverValue:
|
||||
expression = x
|
||||
isSafeNavigation = false
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
|
||||
+3
-1
@@ -3,7 +3,9 @@ KtSuccessCallInfo:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = x
|
||||
isSafeNavigation = false
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = kotlin.Int
|
||||
returnType = kotlin.String
|
||||
|
||||
Reference in New Issue
Block a user