[NI] Allow capturing type projections with type variables
#KT-25302 Fixed
This commit is contained in:
+13
-13
@@ -5,28 +5,21 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.calls.inference.model
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.resolve.calls.components.BuiltInsProvider
|
||||
import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.*
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.*
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintInjector
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.KotlinConstraintSystemCompleter
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.ResultTypeResolver
|
||||
import org.jetbrains.kotlin.resolve.calls.model.KotlinCallDiagnostic
|
||||
import org.jetbrains.kotlin.types.StubType
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import org.jetbrains.kotlin.types.TypeProjectionImpl
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
import org.jetbrains.kotlin.types.checker.ClassicTypeSystemContext
|
||||
import org.jetbrains.kotlin.types.checker.NewCapturedType
|
||||
import org.jetbrains.kotlin.types.checker.NewCapturedTypeConstructor
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.cast
|
||||
import kotlin.math.max
|
||||
|
||||
class NewConstraintSystemImpl(
|
||||
private val constraintInjector: ConstraintInjector,
|
||||
val typeSystemContext: TypeSystemInferenceExtensionContext//,
|
||||
//override val builtIns: KotlinBuiltIns
|
||||
val typeSystemContext: TypeSystemInferenceExtensionContext
|
||||
) :
|
||||
TypeSystemInferenceExtensionContext by typeSystemContext,
|
||||
NewConstraintSystem,
|
||||
@@ -184,7 +177,14 @@ class NewConstraintSystemImpl(
|
||||
override fun isProperType(type: KotlinTypeMarker): Boolean {
|
||||
checkState(State.BUILDING, State.COMPLETION, State.TRANSACTION)
|
||||
return !type.contains {
|
||||
storage.allTypeVariables.containsKey(it.typeConstructor())
|
||||
val capturedType = it.asSimpleType()?.asCapturedType()
|
||||
// TODO: change NewCapturedType to markered one for FE-IR
|
||||
val typeToCheck = if (capturedType is NewCapturedType && capturedType.captureStatus() == CaptureStatus.FROM_EXPRESSION)
|
||||
capturedType.constructor.projection.type
|
||||
else
|
||||
it
|
||||
|
||||
storage.allTypeVariables.containsKey(typeToCheck.typeConstructor())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user