Minor: reformat CapturedTypeConstructor.kt according to code style
This commit is contained in:
+9
-6
@@ -70,7 +70,8 @@ class CapturedType(
|
|||||||
|
|
||||||
override val memberScope: MemberScope
|
override val memberScope: MemberScope
|
||||||
get() = ErrorUtils.createErrorScope(
|
get() = ErrorUtils.createErrorScope(
|
||||||
"No member resolution should be done on captured type, it used only during constraint system resolution", true)
|
"No member resolution should be done on captured type, it used only during constraint system resolution", true
|
||||||
|
)
|
||||||
|
|
||||||
override val subTypeRepresentative: KotlinType
|
override val subTypeRepresentative: KotlinType
|
||||||
get() = representative(OUT_VARIANCE, builtIns.nullableAnyType)
|
get() = representative(OUT_VARIANCE, builtIns.nullableAnyType)
|
||||||
@@ -90,11 +91,11 @@ class CapturedType(
|
|||||||
return CapturedType(typeProjection, constructor, newNullability, annotations)
|
return CapturedType(typeProjection, constructor, newNullability, annotations)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceAnnotations(newAnnotations: Annotations): CapturedType = CapturedType(typeProjection, constructor, isMarkedNullable, newAnnotations)
|
override fun replaceAnnotations(newAnnotations: Annotations): CapturedType =
|
||||||
|
CapturedType(typeProjection, constructor, isMarkedNullable, newAnnotations)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createCapturedType(typeProjection: TypeProjection): KotlinType
|
fun createCapturedType(typeProjection: TypeProjection): KotlinType = CapturedType(typeProjection)
|
||||||
= CapturedType(typeProjection)
|
|
||||||
|
|
||||||
fun KotlinType.isCaptured(): Boolean = constructor is CapturedTypeConstructor
|
fun KotlinType.isCaptured(): Boolean = constructor is CapturedTypeConstructor
|
||||||
|
|
||||||
@@ -105,11 +106,13 @@ fun TypeSubstitution.wrapWithCapturingSubstitution(needApproximation: Boolean =
|
|||||||
this.arguments.zip(this.parameters).map {
|
this.arguments.zip(this.parameters).map {
|
||||||
it.first.createCapturedIfNeeded(it.second)
|
it.first.createCapturedIfNeeded(it.second)
|
||||||
}.toTypedArray(),
|
}.toTypedArray(),
|
||||||
approximateCapturedTypes = needApproximation)
|
approximateCapturedTypes = needApproximation
|
||||||
|
)
|
||||||
else
|
else
|
||||||
object : DelegatedTypeSubstitution(this@wrapWithCapturingSubstitution) {
|
object : DelegatedTypeSubstitution(this@wrapWithCapturingSubstitution) {
|
||||||
override fun approximateContravariantCapturedTypes() = needApproximation
|
override fun approximateContravariantCapturedTypes() = needApproximation
|
||||||
override fun get(key: KotlinType) = super.get(key)?.createCapturedIfNeeded(key.constructor.declarationDescriptor as? TypeParameterDescriptor)
|
override fun get(key: KotlinType) =
|
||||||
|
super.get(key)?.createCapturedIfNeeded(key.constructor.declarationDescriptor as? TypeParameterDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun TypeProjection.createCapturedIfNeeded(typeParameterDescriptor: TypeParameterDescriptor?): TypeProjection {
|
private fun TypeProjection.createCapturedIfNeeded(typeParameterDescriptor: TypeParameterDescriptor?): TypeProjection {
|
||||||
|
|||||||
Reference in New Issue
Block a user