Check for cancelation during type inference

This should slightly mitigate the UI freezes caused by KT-47545.
This commit is contained in:
Matthew Gharrity
2021-06-30 11:14:03 -04:00
committed by Victor Petukhov
parent 487524f6b0
commit e27b75bfba
@@ -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