Minor: reformat NewCapturedType.kt according to code style

This commit is contained in:
Dmitriy Novozhilov
2019-02-06 10:55:28 +03:00
parent 9129210cfe
commit 3f4df6160c
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.utils.DO_NOTHING_2
// null means that type should be leaved as is // null means that type should be leaved as is
fun prepareArgumentTypeRegardingCaptureTypes(argumentType: UnwrappedType): UnwrappedType? { fun prepareArgumentTypeRegardingCaptureTypes(argumentType: UnwrappedType): UnwrappedType? {
val simpleType = NewKotlinTypeChecker.transformToNewType(argumentType.lowerIfFlexible()) val simpleType = NewKotlinTypeChecker.transformToNewType(argumentType.lowerIfFlexible())
if (simpleType.constructor is IntersectionTypeConstructor){ if (simpleType.constructor is IntersectionTypeConstructor) {
var changed = false var changed = false
val preparedSuperTypes = simpleType.constructor.supertypes.map { val preparedSuperTypes = simpleType.constructor.supertypes.map {
prepareArgumentTypeRegardingCaptureTypes(it.unwrap())?.apply { changed = true } ?: it.unwrap() prepareArgumentTypeRegardingCaptureTypes(it.unwrap())?.apply { changed = true } ?: it.unwrap()
@@ -78,8 +78,7 @@ fun captureFromArguments(
val arguments = type.arguments val arguments = type.arguments
if (arguments.all { it.projectionKind == Variance.INVARIANT }) return null if (arguments.all { it.projectionKind == Variance.INVARIANT }) return null
val newArguments = arguments.map { val newArguments = arguments.map { projection ->
projection ->
if (projection.projectionKind == Variance.INVARIANT) return@map projection if (projection.projectionKind == Variance.INVARIANT) return@map projection
val lowerType = if (!projection.isStarProjection && projection.projectionKind == Variance.IN_VARIANCE) { val lowerType = if (!projection.isStarProjection && projection.projectionKind == Variance.IN_VARIANCE) {
@@ -130,7 +129,7 @@ class NewCapturedType(
val lowerType: UnwrappedType?, // todo check lower type for nullable captured types val lowerType: UnwrappedType?, // todo check lower type for nullable captured types
override val annotations: Annotations = Annotations.EMPTY, override val annotations: Annotations = Annotations.EMPTY,
override val isMarkedNullable: Boolean = false override val isMarkedNullable: Boolean = false
): SimpleType() { ) : SimpleType() {
internal constructor(captureStatus: CaptureStatus, lowerType: UnwrappedType?, projection: TypeProjection) : internal constructor(captureStatus: CaptureStatus, lowerType: UnwrappedType?, projection: TypeProjection) :
this(captureStatus, NewCapturedTypeConstructor(projection), lowerType) this(captureStatus, NewCapturedTypeConstructor(projection), lowerType)
@@ -146,7 +145,8 @@ class NewCapturedType(
NewCapturedType(captureStatus, constructor, lowerType, annotations, newNullability) NewCapturedType(captureStatus, constructor, lowerType, annotations, newNullability)
} }
class NewCapturedTypeConstructor(override val projection: TypeProjection, private var supertypes: List<UnwrappedType>? = null) : CapturedTypeConstructor { class NewCapturedTypeConstructor(override val projection: TypeProjection, private var supertypes: List<UnwrappedType>? = null) :
CapturedTypeConstructor {
fun initializeSupertypes(supertypes: List<UnwrappedType>) { fun initializeSupertypes(supertypes: List<UnwrappedType>) {
assert(this.supertypes == null) { assert(this.supertypes == null) {
"Already initialized! oldValue = ${this.supertypes}, newValue = $supertypes" "Already initialized! oldValue = ${this.supertypes}, newValue = $supertypes"