FIR2IR: determine type parameters before value parameters

Type parameters can be referred from value parameters,
so we should determine them earlier to be able to set their indexes
This commit is contained in:
Mikhail Glukhikh
2020-02-20 13:24:10 +03:00
parent 334cab7357
commit 8c21f04bf4
8 changed files with 4 additions and 10 deletions
@@ -398,6 +398,9 @@ class Fir2IrDeclarationStorage(
private fun <T : IrFunction> T.declareParameters(function: FirFunction<*>?, containingClass: IrClass?, isStatic: Boolean) {
val parent = this
if (function is FirSimpleFunction) {
setTypeParameters(function)
}
if (function is FirDefaultPropertySetter) {
val type = function.valueParameters.first().returnTypeRef.toIrType(session, this@Fir2IrDeclarationStorage)
declareDefaultSetterParameter(type)
@@ -408,9 +411,6 @@ class Fir2IrDeclarationStorage(
}
if (function !is FirConstructor) {
val thisOrigin = IrDeclarationOrigin.DEFINED
if (function is FirSimpleFunction) {
setTypeParameters(function)
}
val receiverTypeRef = function?.receiverTypeRef
if (receiverTypeRef != null) {
extensionReceiverParameter = receiverTypeRef.convertWithOffsets { startOffset, endOffset ->