From 9c6ed2ea02c8f9a1c2a6ea5be3a1a773ba35f4af Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 25 Jun 2020 17:22:08 +0300 Subject: [PATCH] [FIR] Complete delegate calls in default inference session --- .../AbstractManyCandidatesInferenceSession.kt | 32 +++++++++---------- .../featureIntersection/delegate.kt | 1 - 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/AbstractManyCandidatesInferenceSession.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/AbstractManyCandidatesInferenceSession.kt index 120e9840575..50000ecb273 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/AbstractManyCandidatesInferenceSession.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/AbstractManyCandidatesInferenceSession.kt @@ -61,29 +61,27 @@ abstract class AbstractManyCandidatesInferenceSession( } fun completeCandidates(): List { - fun runCompletion(constraintSystem: NewConstraintSystem, atoms: List) { - components.callCompleter.completer.complete( - constraintSystem.asConstraintSystemCompleterContext(), - KotlinConstraintSystemCompleter.ConstraintSystemCompletionMode.FULL, - atoms, - unitType - ) { - postponedArgumentsAnalyzer.analyze( - constraintSystem.asPostponedArgumentsAnalyzerContext(), - it, - (atoms.first() as FirResolvable).candidate - ) - } - } - @Suppress("UNCHECKED_CAST") val resolvedCalls = partiallyResolvedCalls.map { it.first } val commonSystem = components.inferenceComponents.createConstraintSystem().apply { addOtherSystem(currentConstraintSystem) } prepareForCompletion(commonSystem, resolvedCalls) - @Suppress("UNCHECKED_CAST") - runCompletion(commonSystem, resolvedCalls as List) + components.inferenceComponents.withInferenceSession(DEFAULT) { + @Suppress("UNCHECKED_CAST") + components.callCompleter.completer.complete( + commonSystem.asConstraintSystemCompleterContext(), + KotlinConstraintSystemCompleter.ConstraintSystemCompletionMode.FULL, + resolvedCalls as List, + unitType + ) { + postponedArgumentsAnalyzer.analyze( + commonSystem.asPostponedArgumentsAnalyzerContext(), + it, + resolvedCalls.first().candidate + ) + } + } resultingConstraintSystem = commonSystem return resolvedCalls } diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt index 10149df4970..4a4c44d03b3 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME // WITH_COROUTINES