[NI] Analyse lambda in factory pattern resolution in independent context

This commit is contained in:
Dmitriy Novozhilov
2020-04-24 13:14:12 +03:00
parent a0c7bece93
commit e7869bd9d4
10 changed files with 144 additions and 6 deletions
@@ -95,7 +95,8 @@ class KotlinResolutionCallbacksImpl(
parameters: List<UnwrappedType>,
expectedReturnType: UnwrappedType?,
annotations: Annotations,
stubsForPostponedVariables: Map<NewTypeVariable, StubType>
stubsForPostponedVariables: Map<NewTypeVariable, StubType>,
shouldRunInIndependentContext: Boolean
): ReturnArgumentsAnalysisResult {
val psiCallArgument = lambdaArgument.psiCallArgument as PSIFunctionKotlinCallArgument
val outerCallContext = psiCallArgument.outerCallContext
@@ -137,7 +138,7 @@ class KotlinResolutionCallbacksImpl(
val lambdaInfo = LambdaInfo(
expectedReturnType ?: TypeUtils.NO_EXPECTED_TYPE,
if (expectedReturnType == null) ContextDependency.DEPENDENT else ContextDependency.INDEPENDENT
if (expectedReturnType != null || shouldRunInIndependentContext) ContextDependency.INDEPENDENT else ContextDependency.DEPENDENT
)
val builtIns = outerCallContext.scope.ownerDescriptor.builtIns