Code transformation

This commit is contained in:
Valentin Kipyatkov
2015-11-10 19:00:25 +03:00
parent a3b11f4214
commit 80a788cf53
@@ -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))
} }
} }