Minor, introduce IrType.classOrNull

This commit is contained in:
Alexander Udalov
2019-03-22 18:23:08 +01:00
parent dada35d785
commit 1ee4313803
4 changed files with 11 additions and 9 deletions
@@ -44,6 +44,9 @@ val IrType.classifierOrFail: IrClassifierSymbol
val IrType.classifierOrNull: IrClassifierSymbol?
get() = safeAs<IrSimpleType>()?.classifier
val IrType.classOrNull: IrClassSymbol?
get() = classifierOrNull as? IrClassSymbol
fun IrType.makeNotNull() =
if (this is IrSimpleType && this.hasQuestionMark) {
IrSimpleTypeImpl(
@@ -82,7 +85,7 @@ fun IrType.toKotlinType(): KotlinType {
}
fun IrType.getClass(): IrClass? =
(this.classifierOrNull as? IrClassSymbol)?.owner
classOrNull?.owner
fun IrClassSymbol.createType(hasQuestionMark: Boolean, arguments: List<IrTypeArgument>): IrSimpleType =
IrSimpleTypeImpl(