IR fix IrType.makeNullable() for DNN type
This commit is contained in:
@@ -108,17 +108,28 @@ fun IrType.makeNotNull() =
|
|||||||
kotlinType = originalKotlinType?.makeNotNullable()
|
kotlinType = originalKotlinType?.makeNotNullable()
|
||||||
hasQuestionMark = false
|
hasQuestionMark = false
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
this
|
this
|
||||||
|
}
|
||||||
|
|
||||||
fun IrType.makeNullable() =
|
fun IrType.makeNullable(): IrType =
|
||||||
if (this is IrSimpleType && !this.hasQuestionMark)
|
when (this) {
|
||||||
buildSimpleType {
|
is IrSimpleType -> {
|
||||||
kotlinType = originalKotlinType?.makeNullable()
|
if (this.hasQuestionMark)
|
||||||
hasQuestionMark = true
|
this
|
||||||
|
else
|
||||||
|
buildSimpleType {
|
||||||
|
kotlinType = originalKotlinType?.makeNullable()
|
||||||
|
hasQuestionMark = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
is IrDefinitelyNotNullType -> {
|
||||||
this
|
// '{ T & Any }?' => 'T?'
|
||||||
|
this.original.makeNullable()
|
||||||
|
}
|
||||||
|
else ->
|
||||||
|
this
|
||||||
|
}
|
||||||
|
|
||||||
@ObsoleteDescriptorBasedAPI
|
@ObsoleteDescriptorBasedAPI
|
||||||
fun IrType.toKotlinType(): KotlinType {
|
fun IrType.toKotlinType(): KotlinType {
|
||||||
|
|||||||
Reference in New Issue
Block a user