FIR [rendering only]: render fake overrides for properties

This commit is contained in:
Mikhail Glukhikh
2019-11-14 15:34:59 +03:00
parent 4733c78a6a
commit 63f38bb28a
7 changed files with 13 additions and 10 deletions
@@ -11,10 +11,10 @@ FILE: extensionPropertyInLambda.kt
}
public final var <T> R|C<T>|.y: R|T|
public get(): R|T| {
^ this@R|/C|.R|/C.x|
^ this@R|/C|.R|FakeOverride</C.x: R|T|>|
}
public set(v: R|T|): R|kotlin/Unit| {
this@R|/C|.R|/C.x| = R|<local>/v|
this@R|/C|.R|FakeOverride</C.x: R|T|>| = R|<local>/v|
}
public final fun use(f: R|() -> kotlin/String|): R|kotlin/Unit| {
}
@@ -16,7 +16,7 @@ FILE: genericPropertyAccess.kt
}
public final override fun foo(): R|T| {
^foo this@R|/Base|.R|/Base.x|
^foo this@R|/Base|.R|FakeOverride</Base.x: R|T|>|
}
}
@@ -13,7 +13,7 @@ FILE: User.kt
protected abstract fun createSettings(): R|T|
public final fun foo(): R|kotlin/Unit| {
this@R|/User|.R|/User.settings| = Q|StaticOwner|.R|/StaticOwner.newInstance|<R|T|>(this@R|/User|.R|/User.settings|.R|kotlin/jvm/javaClass|)
this@R|/User|.R|FakeOverride</User.settings: R|T|>| = Q|StaticOwner|.R|/StaticOwner.newInstance|<R|T|>(this@R|/User|.R|FakeOverride</User.settings: R|T|>|.R|kotlin/jvm/javaClass|)
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ FILE: problems.kt
}
}
public final val xx: R|kotlin/Int| = R|/Derived.Derived|().R|/Base.x|.R|kotlin/Int.plus|(Int(1))
public final val xx: R|kotlin/Int| = R|/Derived.Derived|().R|FakeOverride</Base.x: R|kotlin/Int|>|.R|kotlin/Int.plus|(Int(1))
public get(): R|kotlin/Int|
public final val t: R|kotlin/Nothing| = throw R|java/lang/AssertionError.AssertionError|(String())
public get(): R|kotlin/Nothing|
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.fir.types.impl.FirImplicitBuiltinTypeRef
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.types.Variance
@@ -821,12 +820,16 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
override fun visitResolvedNamedReference(resolvedNamedReference: FirResolvedNamedReference) {
print("R|")
val isFakeOverride = (resolvedNamedReference.resolvedSymbol as? FirNamedFunctionSymbol)?.isFakeOverride == true
val symbol = resolvedNamedReference.resolvedSymbol
val isFakeOverride = when (symbol) {
is FirNamedFunctionSymbol -> symbol.isFakeOverride
is FirPropertySymbol -> symbol.isFakeOverride
else -> false
}
if (isFakeOverride) {
print("FakeOverride<")
}
val symbol = resolvedNamedReference.resolvedSymbol
print(symbol.render())
@@ -50,7 +50,7 @@ FILE fqName:<root> fileName:/genericPropertyReferenceType.kt
correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var]
VALUE_PARAMETER name:v index:0 type:T of <uninitialized parent>
BLOCK_BODY
ERROR_CALL 'Unresolved reference: R|/C.x|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|FakeOverride</C.x: R|T|>|' type=IrErrorType
FUN name:use visibility:public modality:FINAL <> (p:kotlin.reflect.KMutableProperty<kotlin.String>) returnType:kotlin.Unit
VALUE_PARAMETER name:p index:0 type:kotlin.reflect.KMutableProperty<kotlin.String>
BLOCK_BODY
@@ -18,7 +18,7 @@ FILE fqName:<root> fileName:/smartCastOnReceiverOfGenericType.kt
GET_VAR 'a: kotlin.Any declared in <root>.testProperty' type=kotlin.Any origin=null
TYPE_OP type=kotlin.String origin=CAST typeOperand=kotlin.String
GET_VAR 'b: kotlin.Any declared in <root>.testProperty' type=kotlin.Any origin=null
ERROR_CALL 'Unresolved reference: R|/Cell.value|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|FakeOverride</Cell.value: R|kotlin/String|>|' type=IrErrorType
FUN name:testInnerClass visibility:public modality:FINAL <> (a:kotlin.Any, b:kotlin.Any, c:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any
VALUE_PARAMETER name:b index:1 type:kotlin.Any