FIR: check multiple vararg param and forbidden vararg type

This commit is contained in:
Tianyu Geng
2021-02-22 18:24:46 -08:00
committed by Mikhail Glukhikh
parent 0e9474342d
commit bdeecfc188
22 changed files with 130 additions and 83 deletions
@@ -69,9 +69,15 @@ val ConeKotlinType.isArrayType: Boolean
return isBuiltinType(StandardClassIds.Array, false) ||
StandardClassIds.primitiveArrayTypeByElementType.values.any { isBuiltinType(it, false) }
}
private val builtinUnsignedTypes = setOf(StandardClassIds.UInt, StandardClassIds.UByte, StandardClassIds.ULong, StandardClassIds.UShort)
val ConeKotlinType.isUnsignedTypeOrNullableUnsignedType: Boolean get() = isAnyOfBuiltinType(builtinUnsignedTypes)
private fun ConeKotlinType.isBuiltinType(classId: ClassId, isNullable: Boolean): Boolean {
if (this !is ConeClassLikeType) return false
return lookupTag.classId == classId && type.isNullable == isNullable
}
private fun ConeKotlinType.isAnyOfBuiltinType(classIds: Set<ClassId>): Boolean {
if (this !is ConeClassLikeType) return false
return lookupTag.classId in classIds
}