IR: add toString for IrBased descriptors

To help in diagnosing issues like KT-44160.
This commit is contained in:
Alexander Udalov
2020-12-30 20:31:04 +01:00
parent 3c37bbaf64
commit ac325f6111
@@ -89,16 +89,15 @@ abstract class IrBasedDeclarationDescriptor<T : IrDeclaration>(val owner: T) : D
} }
} }
override fun getContainingDeclaration() = getContainingDeclaration(owner) override fun getContainingDeclaration(): DeclarationDescriptor =
getContainingDeclaration(owner)
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean =
if (other !is IrBasedDeclarationDescriptor<*>) return false other is IrBasedDeclarationDescriptor<*> && owner == other.owner
return owner == other.owner
}
override fun hashCode(): Int { override fun hashCode(): Int = owner.hashCode()
return owner.hashCode()
} override fun toString(): String = javaClass.simpleName + ": " + owner.render()
} }
fun IrDeclaration.toIrBasedDescriptor(): DeclarationDescriptor = when (this) { fun IrDeclaration.toIrBasedDescriptor(): DeclarationDescriptor = when (this) {