FIR2IR: standardize expression with smart cast conversion
To convert smart cast expression, now we just convert original expression in standard way and wrap it with TYPE_OP. Before this commit original expression was converted in different way, that led to errors e.g. for this expression casting.
This commit is contained in:
@@ -936,7 +936,7 @@ class Fir2IrVisitor(
|
||||
|
||||
override fun visitExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast, data: Any?): IrElement {
|
||||
// Generate the expression with the original type and then cast it to the smart cast type.
|
||||
val value = expressionWithSmartcast.toIrExpression(expressionWithSmartcast.originalType).applyReceivers(expressionWithSmartcast)
|
||||
val value = expressionWithSmartcast.originalExpression.toIrExpression()
|
||||
val castType = expressionWithSmartcast.typeRef.toIrType(session, declarationStorage)
|
||||
if (value.type == castType) return value
|
||||
return IrTypeOperatorCallImpl(
|
||||
|
||||
Reference in New Issue
Block a user