ConeTypeIntersector: inline flatIntersectionTypes
This commit is contained in:
committed by
Space Team
parent
45e884ec67
commit
8bc9fd91d5
@@ -17,8 +17,15 @@ object ConeTypeIntersector {
|
|||||||
1 -> return types.single()
|
1 -> return types.single()
|
||||||
}
|
}
|
||||||
|
|
||||||
val inputTypes = mutableListOf<ConeKotlinType>()
|
val inputTypes = mutableListOf<ConeKotlinType>().apply {
|
||||||
flatIntersectionTypes(types, inputTypes)
|
for (inputType in types) {
|
||||||
|
if (inputType is ConeIntersectionType) {
|
||||||
|
addAll(inputType.intersectedTypes)
|
||||||
|
} else {
|
||||||
|
add(inputType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* resultNullability. Value description:
|
* resultNullability. Value description:
|
||||||
@@ -85,21 +92,6 @@ object ConeTypeIntersector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun flatIntersectionTypes(
|
|
||||||
inputTypes: List<ConeKotlinType>,
|
|
||||||
typeCollector: MutableList<ConeKotlinType>
|
|
||||||
) {
|
|
||||||
for (inputType in inputTypes) {
|
|
||||||
if (inputType is ConeIntersectionType) {
|
|
||||||
for (type in inputType.intersectedTypes) {
|
|
||||||
typeCollector += type
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
typeCollector += inputType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun ConeKotlinType.isStrictSubtypeOf(context: ConeTypeContext, supertype: ConeKotlinType): Boolean =
|
private fun ConeKotlinType.isStrictSubtypeOf(context: ConeTypeContext, supertype: ConeKotlinType): Boolean =
|
||||||
AbstractTypeChecker.isSubtypeOf(context, this, supertype) && !AbstractTypeChecker.isSubtypeOf(context, supertype, this)
|
AbstractTypeChecker.isSubtypeOf(context, this, supertype) && !AbstractTypeChecker.isSubtypeOf(context, supertype, this)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user