Introduce specific error for calls which could be resolved only with unrestricted builder inference
^KT-47747 Fixed
This commit is contained in:
committed by
teamcityserver
parent
357fda2efa
commit
6a1ec92d39
+1
@@ -15,6 +15,7 @@ interface ConstraintSystemOperation {
|
||||
val hasContradiction: Boolean
|
||||
fun registerVariable(variable: TypeVariableMarker)
|
||||
fun markPostponedVariable(variable: TypeVariableMarker)
|
||||
fun markCouldBeResolvedWithUnrestrictedBuilderInference()
|
||||
fun unmarkPostponedVariable(variable: TypeVariableMarker)
|
||||
fun removePostponedVariables()
|
||||
|
||||
|
||||
+2
@@ -32,4 +32,6 @@ interface ConstraintSystemCompletionContext : VariableFixationFinder.Context, Re
|
||||
fun fixVariable(variable: TypeVariableMarker, resultType: KotlinTypeMarker, position: FixVariableConstraintPosition<*>)
|
||||
|
||||
fun asConstraintSystemCompletionContext(): ConstraintSystemCompletionContext
|
||||
|
||||
fun couldBeResolvedWithUnrestrictedBuilderInference(): Boolean
|
||||
}
|
||||
|
||||
+2
-1
@@ -118,7 +118,8 @@ class CapturedTypeFromSubtyping(
|
||||
|
||||
open class NotEnoughInformationForTypeParameter<T>(
|
||||
val typeVariable: TypeVariableMarker,
|
||||
val resolvedAtom: T
|
||||
val resolvedAtom: T,
|
||||
val couldBeResolvedWithUnrestrictedBuilderInference: Boolean
|
||||
) : ConstraintSystemError(INAPPLICABLE)
|
||||
|
||||
class ConstrainingTypeIsError(
|
||||
|
||||
+9
@@ -38,6 +38,8 @@ class NewConstraintSystemImpl(
|
||||
private val properTypesCache: MutableSet<KotlinTypeMarker> = SmartSet.create()
|
||||
private val notProperTypesCache: MutableSet<KotlinTypeMarker> = SmartSet.create()
|
||||
|
||||
private var couldBeResolvedWithUnrestrictedBuilderInference: Boolean = false
|
||||
|
||||
private enum class State {
|
||||
BUILDING,
|
||||
TRANSACTION,
|
||||
@@ -118,6 +120,13 @@ class NewConstraintSystemImpl(
|
||||
storage.postponedTypeVariables += variable
|
||||
}
|
||||
|
||||
override fun markCouldBeResolvedWithUnrestrictedBuilderInference() {
|
||||
couldBeResolvedWithUnrestrictedBuilderInference = true
|
||||
}
|
||||
|
||||
override fun couldBeResolvedWithUnrestrictedBuilderInference() =
|
||||
couldBeResolvedWithUnrestrictedBuilderInference
|
||||
|
||||
override fun unmarkPostponedVariable(variable: TypeVariableMarker) {
|
||||
storage.postponedTypeVariables -= variable
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user