Use original descriptors on implicit coercion to unit generation
This commit is contained in:
+6
-1
@@ -233,7 +233,7 @@ class InsertImplicitCasts(context: GeneratorContext) : IrElementTransformerVoid(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun IrExpression.coerceToUnit(): IrExpression {
|
private fun IrExpression.coerceToUnit(): IrExpression {
|
||||||
val valueType = this.type.originalKotlinType!!
|
val valueType = getKotlinType(this)
|
||||||
|
|
||||||
return if (KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType, builtIns.unitType))
|
return if (KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType, builtIns.unitType))
|
||||||
this
|
this
|
||||||
@@ -247,6 +247,11 @@ class InsertImplicitCasts(context: GeneratorContext) : IrElementTransformerVoid(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getKotlinType(irExpression: IrExpression) =
|
||||||
|
if (irExpression is IrCall)
|
||||||
|
irExpression.symbol.descriptor.original.returnType!!
|
||||||
|
else irExpression.type.originalKotlinType!!
|
||||||
|
|
||||||
private fun KotlinType.isBuiltInIntegerType(): Boolean =
|
private fun KotlinType.isBuiltInIntegerType(): Boolean =
|
||||||
KotlinBuiltIns.isByte(this) ||
|
KotlinBuiltIns.isByte(this) ||
|
||||||
KotlinBuiltIns.isShort(this) ||
|
KotlinBuiltIns.isShort(this) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user