Fix an assertion for type parameters

This commit is contained in:
Ting-Yuan Huang
2019-03-21 16:46:07 -07:00
committed by Dmitry Petrov
parent acf8a0454f
commit 4ff2825de0
3 changed files with 8 additions and 4 deletions
@@ -80,6 +80,9 @@ fun KotlinType.isPrimitiveNumberOrNullableType(): Boolean =
fun KotlinType.isTypeParameter(): Boolean = TypeUtils.isTypeParameter(this)
fun KotlinType.upperBoundedByPrimitiveNumberOrNullableType(): Boolean =
TypeUtils.getTypeParameterDescriptorOrNull(this)?.upperBounds?.any { it.isPrimitiveNumberOrNullableType() } == true
fun KotlinType.isInterface(): Boolean = (constructor.declarationDescriptor as? ClassDescriptor)?.kind == ClassKind.INTERFACE
fun KotlinType.isEnum(): Boolean = (constructor.declarationDescriptor as? ClassDescriptor)?.kind == ClassKind.ENUM_CLASS