FIR: skip return insertion for lambda w/ Unit return type

This commit is contained in:
Jinseong Jeon
2020-08-20 23:41:09 -07:00
committed by Mikhail Glukhikh
parent f1ce668ede
commit ca541337d1
27 changed files with 52 additions and 55 deletions
@@ -35,15 +35,21 @@ val FirTypeRef.isArrayType: Boolean
isBuiltinType(StandardClassIds.Array, false) ||
StandardClassIds.primitiveArrayTypeByElementType.values.any { isBuiltinType(it, false) }
private fun FirTypeRef.isBuiltinType(classId: ClassId, isNullable: Boolean): Boolean {
val type = when (this) {
private val FirTypeRef.classLikeTypeOrNull: ConeClassLikeType?
get() = when (this) {
is FirImplicitBuiltinTypeRef -> type
is FirResolvedTypeRef -> type as? ConeClassLikeType ?: return false
else -> return false
is FirResolvedTypeRef -> type as? ConeClassLikeType
else -> null
}
private fun FirTypeRef.isBuiltinType(classId: ClassId, isNullable: Boolean): Boolean {
val type = this.classLikeTypeOrNull ?: return false
return type.lookupTag.classId == classId && type.isNullable == isNullable
}
val FirTypeRef.isMarkedNullable: Boolean?
get() = classLikeTypeOrNull?.isMarkedNullable
val FirFunctionTypeRef.parametersCount: Int
get() = if (receiverTypeRef != null)
valueParameters.size + 1