Code transformation
This commit is contained in:
+9
-10
@@ -26,16 +26,15 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
|||||||
|
|
||||||
class InvokeConventionChecker : CallChecker {
|
class InvokeConventionChecker : CallChecker {
|
||||||
override fun <F : CallableDescriptor> check(resolvedCall: ResolvedCall<F>, context: BasicCallResolutionContext) {
|
override fun <F : CallableDescriptor> check(resolvedCall: ResolvedCall<F>, context: BasicCallResolutionContext) {
|
||||||
if (resolvedCall !is VariableAsFunctionResolvedCallImpl || !resolvedCall.functionCall.dispatchReceiver.exists()
|
if (resolvedCall is VariableAsFunctionResolvedCallImpl) {
|
||||||
|| !resolvedCall.functionCall.extensionReceiver.exists()) {
|
val functionCall = resolvedCall.functionCall
|
||||||
return
|
val variableCall = resolvedCall.variableCall
|
||||||
}
|
if (functionCall.dispatchReceiver.exists() && functionCall.extensionReceiver.exists() && KotlinBuiltIns.isExactExtensionFunctionType(variableCall.resultingDescriptor.type)) {
|
||||||
|
if (variableCall.dispatchReceiver is ExpressionReceiver || variableCall.extensionReceiver is ExpressionReceiver) {
|
||||||
if (!KotlinBuiltIns.isExactExtensionFunctionType(resolvedCall.variableCall.resultingDescriptor.type)) return
|
val callElement = variableCall.call.callElement
|
||||||
|
context.trace.report(Errors.INVOKE_ON_EXTENSION_FUNCTION_WITH_EXPLICIT_DISPATCH_RECEIVER.on(callElement, callElement))
|
||||||
if (resolvedCall.variableCall.dispatchReceiver is ExpressionReceiver || resolvedCall.variableCall.extensionReceiver is ExpressionReceiver) {
|
}
|
||||||
context.trace.report(Errors.INVOKE_ON_EXTENSION_FUNCTION_WITH_EXPLICIT_DISPATCH_RECEIVER.on(
|
}
|
||||||
resolvedCall.variableCall.call.callElement, resolvedCall.variableCall.call.callElement))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user