[FIR2IR] Fix generation of accessors' extension receiver (f/o case)

This commit is contained in:
Mikhail Glukhikh
2020-09-10 14:59:51 +03:00
parent 36d2129fd3
commit ec93e5886a
7 changed files with 5 additions and 8 deletions
@@ -304,7 +304,9 @@ class Fir2IrDeclarationStorage(
with(classifierStorage) {
val thisOrigin = IrDeclarationOrigin.DEFINED
if (function !is FirConstructor) {
val receiverTypeRef = if (function !is FirPropertyAccessor) function?.receiverTypeRef else parentPropertyReceiverType
val receiverTypeRef =
if (function !is FirPropertyAccessor && function != null) function.receiverTypeRef
else parentPropertyReceiverType
if (receiverTypeRef != null) {
extensionReceiverParameter = receiverTypeRef.convertWithOffsets { startOffset, endOffset ->
declareThisReceiverParameter(
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FULL_JDK
@@ -1,5 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface I {
val <T> T.id: T
get() = this
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface I {
val String.foo: String
get() = this + ";" + bar()
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: enable
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: ANDROID
// JVM_TARGET: 1.8
@@ -1,7 +1,6 @@
// TARGET_BACKEND: JVM
// !JVM_DEFAULT_MODE: all
// JVM_TARGET: 1.8
// IGNORE_BACKEND_FIR: JVM_IR
interface Foo<T> {
fun test(p: T) = p
val T.prop: T
@@ -124,12 +124,13 @@ FILE fqName:<root> fileName:/useImportedMember.kt
RETURN type=kotlin.Nothing from='public final fun <get-g2> <T> (): T of <root>.C.<get-g2> declared in <root>.C'
GET_VAR '<this>: T of <root>.C.<get-g2> declared in <root>.C.<get-g2>' type=T of <root>.C.<get-g2> origin=null
PROPERTY FAKE_OVERRIDE name:fromClass visibility:public modality:FINAL [fake_override,val]
FUN FAKE_OVERRIDE name:<get-fromClass> visibility:public modality:FINAL <T> ($this:<root>.BaseClass) returnType:T of <root>.C.<get-fromClass> [fake_override]
FUN FAKE_OVERRIDE name:<get-fromClass> visibility:public modality:FINAL <T> ($this:<root>.BaseClass, $receiver:T of <root>.C.<get-fromClass>) returnType:T of <root>.C.<get-fromClass> [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:fromClass visibility:public modality:FINAL [fake_override,val]
overridden:
public final fun <get-fromClass> <T> (): T of <root>.BaseClass.<get-fromClass> declared in <root>.BaseClass
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.BaseClass
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.C.<get-fromClass>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any