From e27b75bfba15215c65fccbd651d121b4624387a7 Mon Sep 17 00:00:00 2001 From: Matthew Gharrity Date: Wed, 30 Jun 2021 11:14:03 -0400 Subject: [PATCH] Check for cancelation during type inference This should slightly mitigate the UI freezes caused by KT-47545. --- .../calls/inference/components/ConstraintIncorporator.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintIncorporator.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintIncorporator.kt index 8bf648bf568..0952a638b61 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintIncorporator.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintIncorporator.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.resolve.calls.inference.components +import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus import org.jetbrains.kotlin.resolve.calls.inference.model.* import org.jetbrains.kotlin.types.AbstractTypeApproximator import org.jetbrains.kotlin.types.TypeApproximatorConfiguration @@ -42,6 +43,8 @@ class ConstraintIncorporator( // \alpha is typeVariable, \beta -- other type variable registered in ConstraintStorage fun incorporate(c: Context, typeVariable: TypeVariableMarker, constraint: Constraint) { + ProgressIndicatorAndCompilationCanceledStatus.checkCanceled() + // we shouldn't incorporate recursive constraint -- It is too dangerous if (c.areThereRecursiveConstraints(typeVariable, constraint)) return