Correct type of expression produced by enum lowering
This commit is contained in:
committed by
SvyatoslavScherbina
parent
8bc172b9c1
commit
99abe36148
+5
-1
@@ -137,7 +137,11 @@ internal class EnumUsageLowering(val context: Context)
|
|||||||
private fun loadEnumEntry(startOffset: Int, endOffset: Int, enumClass: IrClass, name: Name): IrExpression {
|
private fun loadEnumEntry(startOffset: Int, endOffset: Int, enumClass: IrClass, name: Name): IrExpression {
|
||||||
val loweredEnum = context.specialDeclarationsFactory.getLoweredEnum(enumClass)
|
val loweredEnum = context.specialDeclarationsFactory.getLoweredEnum(enumClass)
|
||||||
val ordinal = loweredEnum.entriesMap[name]!!
|
val ordinal = loweredEnum.entriesMap[name]!!
|
||||||
return irCall(startOffset, endOffset, loweredEnum.itemGetterSymbol.owner, emptyList()).apply {
|
return IrCallImpl(
|
||||||
|
startOffset, endOffset, enumClass.defaultType,
|
||||||
|
loweredEnum.itemGetterSymbol.owner.symbol, loweredEnum.itemGetterSymbol.descriptor,
|
||||||
|
typeArgumentsCount = 0
|
||||||
|
).apply {
|
||||||
dispatchReceiver = IrCallImpl(startOffset, endOffset, loweredEnum.valuesGetter.returnType, loweredEnum.valuesGetter.symbol)
|
dispatchReceiver = IrCallImpl(startOffset, endOffset, loweredEnum.valuesGetter.returnType, loweredEnum.valuesGetter.symbol)
|
||||||
putValueArgument(0, IrConstImpl.int(startOffset, endOffset, context.irBuiltIns.intType, ordinal))
|
putValueArgument(0, IrConstImpl.int(startOffset, endOffset, context.irBuiltIns.intType, ordinal))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user