Prohibit Array<Nothing>

This commit is contained in:
Alexey Tsvetkov
2015-11-27 12:57:34 +03:00
parent 35f788a89c
commit 7384d25cb3
8 changed files with 154 additions and 5 deletions
@@ -55,6 +55,13 @@ fun KotlinType.isAnyOrNullableAny(): Boolean = KotlinBuiltIns.isAnyOrNullableAny
fun KotlinType.isBoolean(): Boolean = KotlinBuiltIns.isBoolean(this)
fun KotlinType.isBooleanOrNullableBoolean(): Boolean = KotlinBuiltIns.isBooleanOrNullableBoolean(this)
fun KotlinType?.isArrayOfNothing(): Boolean {
if (this == null || !KotlinBuiltIns.isArray(this)) return false
val typeArg = arguments.firstOrNull()?.type
return typeArg != null && KotlinBuiltIns.isNothingOrNullableNothing(typeArg)
}
private fun KotlinType.getContainedTypeParameters(): Collection<TypeParameterDescriptor> {
val declarationDescriptor = getConstructor().getDeclarationDescriptor()
if (declarationDescriptor is TypeParameterDescriptor) return listOf(declarationDescriptor)