Fix incorrect unsupported error on synthetic extension call on LHS of ::
#KT-13271 Fixed
This commit is contained in:
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.resolve.BindingContext.CONSTRAINT_SYSTEM_COMPLETER
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode.RESOLVE_FUNCTION_ARGUMENTS
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.getEffectiveExpectedType
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isInvokeCallOnVariable
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.isCallableReference
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.isFakeElement
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallCheckerContext
|
||||
@@ -175,7 +176,7 @@ class CallCompleter(
|
||||
val returnType = candidateDescriptor.returnType
|
||||
|
||||
val expectedReturnType =
|
||||
if (isResolvingCallableReference(call)) {
|
||||
if (call.isCallableReference()) {
|
||||
// TODO: compute generic type argument for R in the kotlin.Function<R> supertype (KT-12963)
|
||||
// TODO: also add constraints for parameter types (KT-12964)
|
||||
if (!TypeUtils.noExpectedType(expectedType) && expectedType.isFunctionType) getReturnTypeFromFunctionType(expectedType)
|
||||
@@ -241,11 +242,6 @@ class CallCompleter(
|
||||
setResultingSubstitutor(system.resultingSubstitutor)
|
||||
}
|
||||
|
||||
private fun isResolvingCallableReference(call: Call): Boolean {
|
||||
val callElement = call.callElement
|
||||
return (callElement.parent as? KtCallableReferenceExpression)?.callableReference == callElement
|
||||
}
|
||||
|
||||
private fun <D : CallableDescriptor> MutableResolvedCall<D>.updateResolutionStatusFromConstraintSystem(
|
||||
context: BasicCallResolutionContext,
|
||||
tracing: TracingStrategy
|
||||
|
||||
@@ -229,6 +229,12 @@ fun Call.isSafeCall(): Boolean {
|
||||
|
||||
fun Call.isExplicitSafeCall(): Boolean = callOperationNode?.elementType == KtTokens.SAFE_ACCESS
|
||||
|
||||
fun Call.isCallableReference(): Boolean {
|
||||
val callElement = callElement
|
||||
return callElement is KtNameReferenceExpression &&
|
||||
(callElement.parent as? KtCallableReferenceExpression)?.callableReference == callElement
|
||||
}
|
||||
|
||||
fun Call.createLookupLocation(): KotlinLookupLocation {
|
||||
val calleeExpression = calleeExpression
|
||||
val element =
|
||||
|
||||
Reference in New Issue
Block a user