diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt index e7d3193efce..ba7d118e1fc 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt @@ -102,7 +102,7 @@ class PostponedArgumentsAnalyzer( } if (inferenceSession != null) { - val storageSnapshot = c.getBuilder().copyCurrentStorage() + val storageSnapshot = c.getBuilder().currentStorage() val postponedVariables = inferenceSession.inferPostponedVariables(storageSnapshot) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemBuilder.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemBuilder.kt index 2be65019c00..5a0d7612f81 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemBuilder.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemBuilder.kt @@ -49,7 +49,7 @@ interface ConstraintSystemBuilder : ConstraintSystemOperation { fun buildCurrentSubstitutor(): NewTypeSubstitutor - fun copyCurrentStorage(): ConstraintStorage + fun currentStorage(): ConstraintStorage } fun ConstraintSystemBuilder.addSubtypeConstraintIfCompatible( diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/MutableConstraintStorage.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/MutableConstraintStorage.kt index 560f6603bd2..5cd03be9182 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/MutableConstraintStorage.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/MutableConstraintStorage.kt @@ -97,32 +97,4 @@ internal class MutableConstraintStorage : ConstraintStorage { override val hasContradiction: Boolean get() = errors.any { !it.candidateApplicability.isSuccess } override val fixedTypeVariables: MutableMap = LinkedHashMap() override val postponedTypeVariables: ArrayList = ArrayList() - - fun copy(): ConstraintStorage { - return object : ConstraintStorage { - override val allTypeVariables: Map = - this@MutableConstraintStorage.allTypeVariables.toMap() - - override val notFixedTypeVariables: Map = - this@MutableConstraintStorage.notFixedTypeVariables.toMap() - - override val initialConstraints: List = - this@MutableConstraintStorage.initialConstraints.toList() - - override val maxTypeDepthFromInitialConstraints: Int = - this@MutableConstraintStorage.maxTypeDepthFromInitialConstraints - - override val errors: List = - this@MutableConstraintStorage.errors.toList() - - override val hasContradiction: Boolean = - this@MutableConstraintStorage.hasContradiction - - override val fixedTypeVariables: Map = - this@MutableConstraintStorage.fixedTypeVariables.toMap() - - override val postponedTypeVariables: List = - this@MutableConstraintStorage.postponedTypeVariables.toList() - } - } } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt index 0a1e28d3e96..1619c3bc146 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt @@ -278,9 +278,9 @@ class NewConstraintSystemImpl( return storage.postponedTypeVariables.associate { it to NonFixedType(it.freshTypeConstructor, it.defaultType.isMarkedNullable) } } - override fun copyCurrentStorage(): ConstraintStorage { + override fun currentStorage(): ConstraintStorage { checkState(State.BUILDING, State.COMPLETION) - return storage.copy() + return storage } // PostponedArgumentsAnalyzer.Context