FIR2IR: fix constructor referencing in return statement
This commit is contained in:
@@ -649,9 +649,13 @@ class Fir2IrVisitor(
|
|||||||
}
|
}
|
||||||
return returnExpression.convertWithOffsets { startOffset, endOffset ->
|
return returnExpression.convertWithOffsets { startOffset, endOffset ->
|
||||||
val result = returnExpression.result
|
val result = returnExpression.result
|
||||||
|
val descriptor = irTarget.descriptor
|
||||||
IrReturnImpl(
|
IrReturnImpl(
|
||||||
startOffset, endOffset, nothingType,
|
startOffset, endOffset, nothingType,
|
||||||
symbolTable.referenceSimpleFunction(irTarget.descriptor),
|
when (descriptor) {
|
||||||
|
is ClassConstructorDescriptor -> symbolTable.referenceConstructor(descriptor)
|
||||||
|
else -> symbolTable.referenceSimpleFunction(descriptor)
|
||||||
|
},
|
||||||
result.toIrExpression()
|
result.toIrExpression()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ FILE fqName:<root> fileName:/implicitCastInReturnFromConstructor.kt
|
|||||||
BRANCH
|
BRANCH
|
||||||
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Unit
|
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Unit
|
||||||
GET_VAR 'x: kotlin.Any? declared in <root>.C.<init>' type=kotlin.Any? origin=null
|
GET_VAR 'x: kotlin.Any? declared in <root>.C.<init>' type=kotlin.Any? origin=null
|
||||||
then: RETURN type=kotlin.Nothing from='public final fun <init> (x: kotlin.Any?): <root>.C declared in <root>.C'
|
then: RETURN type=kotlin.Nothing from='public constructor <init> (x: kotlin.Any?) declared in <root>.C'
|
||||||
GET_VAR 'x: kotlin.Any? declared in <root>.C.<init>' type=kotlin.Unit origin=null
|
GET_VAR 'x: kotlin.Any? declared in <root>.C.<init>' type=kotlin.Unit origin=null
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.C'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.C'
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override]
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override]
|
||||||
|
|||||||
Reference in New Issue
Block a user