PSI2IR: generate IrEnumConstructorCalls with correct return type
Normally, the fact that is was Unit was not visible as enum constructors are lowered to normal class constructors anyway. The exception is when the arguments are reordered, causing the incorrect return type to leak into the block that holds temporary variables.
This commit is contained in:
@@ -160,9 +160,10 @@ class CallGenerator(statementGenerator: StatementGenerator) : StatementGenerator
|
||||
if (dispatchReceiver != null) throw AssertionError("Dispatch receiver should be null: $dispatchReceiver")
|
||||
if (extensionReceiver != null) throw AssertionError("Extension receiver should be null: $extensionReceiver")
|
||||
val constructorSymbol = context.symbolTable.referenceConstructor(constructorDescriptor.original)
|
||||
val irCall = IrEnumConstructorCallImpl(startOffset, endOffset, context.irBuiltIns.unitType, constructorSymbol)
|
||||
val returnType = constructorDescriptor.returnType.toIrType()
|
||||
val irCall = IrEnumConstructorCallImpl(startOffset, endOffset, returnType, constructorSymbol)
|
||||
context.callToSubstitutedDescriptorMap[irCall] = constructorDescriptor
|
||||
addParametersToCall(startOffset, endOffset, call, irCall, context.irBuiltIns.unitType)
|
||||
addParametersToCall(startOffset, endOffset, call, irCall, irCall.type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user