[NI] Resolve collection literals arguments as postponed ones
This commit is contained in:
+12
@@ -194,4 +194,16 @@ class KotlinResolutionCallbacksImpl(
|
||||
|
||||
doubleColonExpressionResolver.checkReferenceIsToAllowedMember(callableCandidate.candidate, topLevelCallContext.trace, callableReferenceExpression)
|
||||
}
|
||||
|
||||
override fun completeCollectionLiteralCalls(collectionLiteralArgument: ResolvedCollectionLiteralArgument) {
|
||||
val psiCallArgument = collectionLiteralArgument.argument.psiCallArgument as CollectionLiteralKotlinCallArgumentImpl
|
||||
val context = psiCallArgument.outerCallContext
|
||||
|
||||
val actualContext = context
|
||||
.replaceBindingTrace(trace)
|
||||
.replaceExpectedType(collectionLiteralArgument.expectedType)
|
||||
.replaceContextDependency(ContextDependency.INDEPENDENT)
|
||||
|
||||
expressionTypingServices.getTypeInfo(psiCallArgument.collectionLiteralExpression, actualContext)
|
||||
}
|
||||
}
|
||||
@@ -115,6 +115,17 @@ class CallableReferenceKotlinCallArgumentImpl(
|
||||
override val rhsName: Name
|
||||
) : CallableReferenceKotlinCallArgument, PSIKotlinCallArgument()
|
||||
|
||||
class CollectionLiteralKotlinCallArgumentImpl(
|
||||
override val valueArgument: ValueArgument,
|
||||
override val argumentName: Name?,
|
||||
override val dataFlowInfoBeforeThisArgument: DataFlowInfo,
|
||||
override val dataFlowInfoAfterThisArgument: DataFlowInfo,
|
||||
val collectionLiteralExpression: KtCollectionLiteralExpression,
|
||||
val outerCallContext: BasicCallResolutionContext
|
||||
) : CollectionLiteralKotlinCallArgument, PSIKotlinCallArgument() {
|
||||
override val isSpread: Boolean get() = valueArgument.getSpreadElement() != null
|
||||
}
|
||||
|
||||
class SubKotlinCallArgumentImpl(
|
||||
override val valueArgument: ValueArgument,
|
||||
override val dataFlowInfoBeforeThisArgument: DataFlowInfo,
|
||||
|
||||
@@ -510,6 +510,11 @@ class PSICallResolver(
|
||||
return lambdaArgument
|
||||
}
|
||||
|
||||
if (ktExpression is KtCollectionLiteralExpression) {
|
||||
return CollectionLiteralKotlinCallArgumentImpl(
|
||||
valueArgument, argumentName, startDataFlowInfo, startDataFlowInfo, ktExpression, outerCallContext)
|
||||
}
|
||||
|
||||
val context = outerCallContext.replaceContextDependency(ContextDependency.DEPENDENT)
|
||||
.replaceExpectedType(TypeUtils.NO_EXPECTED_TYPE).replaceDataFlowInfo(startDataFlowInfo)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user