[IR] Fix fake override checkers

This commit is contained in:
Roman Artemev
2020-03-19 00:36:36 +03:00
committed by romanart
parent cec64a2ec7
commit e4ad6698fb
2 changed files with 5 additions and 3 deletions
@@ -65,7 +65,7 @@ val IrValueParameter.isVararg get() = this.varargElementType != null
val IrFunction.isSuspend get() = this is IrSimpleFunction && this.isSuspend
val IrFunction.isReal get() = this.origin != IrDeclarationOrigin.FAKE_OVERRIDE
val IrFunction.isReal get() = !(this is IrSimpleFunction && isFakeOverride)
fun IrSimpleFunction.overrides(other: IrSimpleFunction): Boolean {
if (this == other) return true
@@ -386,11 +386,13 @@ fun IrAnnotationContainer.hasAnnotation(symbol: IrClassSymbol) =
val IrConstructor.constructedClassType get() = (parent as IrClass).thisReceiver?.type!!
fun IrFunction.isFakeOverriddenFromAny(): Boolean {
if (origin != IrDeclarationOrigin.FAKE_OVERRIDE) {
val simpleFunction = this as? IrSimpleFunction ?: return false
if (!simpleFunction.isFakeOverride) {
return (parent as? IrClass)?.thisReceiver?.type?.isAny() ?: false
}
return (this as IrSimpleFunction).overriddenSymbols.all { it.owner.isFakeOverriddenFromAny() }
return simpleFunction.overriddenSymbols.all { it.owner.isFakeOverriddenFromAny() }
}
fun IrCall.isSuperToAny() = superQualifierSymbol?.let { this.symbol.owner.isFakeOverriddenFromAny() } ?: false