Do subtyping between self types with captured type in special way
This commit is contained in:
+12
-6
@@ -20,8 +20,6 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.resolve.calls.model.CallableReferenceKotlinCallArgument
|
||||
import org.jetbrains.kotlin.resolve.calls.model.LambdaKotlinCallArgument
|
||||
import org.jetbrains.kotlin.resolve.calls.model.PostponableKotlinCallArgument
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasOnlyInputTypesAnnotation
|
||||
@@ -36,7 +34,11 @@ import org.jetbrains.kotlin.types.model.TypeVariableTypeConstructorMarker
|
||||
import org.jetbrains.kotlin.types.refinement.TypeRefinement
|
||||
|
||||
|
||||
class TypeVariableTypeConstructor(private val builtIns: KotlinBuiltIns, val debugName: String) : TypeConstructor,
|
||||
class TypeVariableTypeConstructor(
|
||||
private val builtIns: KotlinBuiltIns,
|
||||
val debugName: String,
|
||||
override val originalTypeParameter: TypeParameterDescriptor?
|
||||
) : TypeConstructor,
|
||||
NewTypeVariableConstructor, TypeVariableTypeConstructorMarker {
|
||||
override fun getParameters(): List<TypeParameterDescriptor> = emptyList()
|
||||
override fun getSupertypes(): Collection<KotlinType> = emptyList()
|
||||
@@ -54,8 +56,12 @@ class TypeVariableTypeConstructor(private val builtIns: KotlinBuiltIns, val debu
|
||||
var isContainedInInvariantOrContravariantPositions: Boolean = false
|
||||
}
|
||||
|
||||
sealed class NewTypeVariable(builtIns: KotlinBuiltIns, name: String) : TypeVariableMarker {
|
||||
val freshTypeConstructor = TypeVariableTypeConstructor(builtIns, name)
|
||||
sealed class NewTypeVariable(
|
||||
builtIns: KotlinBuiltIns,
|
||||
name: String,
|
||||
originalTypeParameter: TypeParameterDescriptor? = null
|
||||
) : TypeVariableMarker {
|
||||
val freshTypeConstructor = TypeVariableTypeConstructor(builtIns, name, originalTypeParameter)
|
||||
|
||||
// member scope is used if we have receiver with type TypeVariable(T)
|
||||
// todo add to member scope methods from supertypes for type variable
|
||||
@@ -75,7 +81,7 @@ fun TypeConstructor.typeForTypeVariable(): SimpleType {
|
||||
|
||||
class TypeVariableFromCallableDescriptor(
|
||||
val originalTypeParameter: TypeParameterDescriptor
|
||||
) : NewTypeVariable(originalTypeParameter.builtIns, originalTypeParameter.name.identifier) {
|
||||
) : NewTypeVariable(originalTypeParameter.builtIns, originalTypeParameter.name.identifier, originalTypeParameter) {
|
||||
override fun hasOnlyInputTypesAnnotation(): Boolean = originalTypeParameter.hasOnlyInputTypesAnnotation()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user