[FIR] Handle 'EnhancedNullability' more properly
This commit includes three changes: 1. 'EnhancedNullability' is no more set for declaration types 2. It is no more used for conversion types in translator 3. Translator inserts implicit not-null cast only when enhanced type is cast to not-null type.
This commit is contained in:
@@ -50,6 +50,18 @@ fun IrType.addAnnotations(newAnnotations: List<IrConstructorCall>): IrType =
|
||||
this
|
||||
}
|
||||
|
||||
fun IrType.removeAnnotations(predicate: (IrConstructorCall) -> Boolean): IrType =
|
||||
when (this) {
|
||||
is IrSimpleType ->
|
||||
toBuilder().apply {
|
||||
annotations = annotations.filterNot(predicate)
|
||||
}.buildSimpleType()
|
||||
is IrDynamicType ->
|
||||
IrDynamicTypeImpl(null, annotations.filterNot(predicate), Variance.INVARIANT)
|
||||
else ->
|
||||
this
|
||||
}
|
||||
|
||||
val IrType.classifierOrFail: IrClassifierSymbol
|
||||
get() = cast<IrSimpleType>().classifier
|
||||
|
||||
|
||||
Reference in New Issue
Block a user