IR: rename {name,fqName}Safe -> {name,fqName}ForIrSerialization

These properties have a very specific detail in their behavior, in that
the constructor's name is set to be "<init>". While this is OK for the
IR serialization, this may not always be expected in other cases, and
their rather common names (`name`, `fqNameSafe`) suggested that these
properties could be used in generic contexts.

Change all usages outside IR serialization to use
`IrDeclarationWithName.name` and nullable
`IrDeclarationWithName.fqNameWhenAvailable` instead
This commit is contained in:
Alexander Udalov
2019-05-21 18:50:04 +02:00
parent 4e1effd065
commit 8dc34ae7b9
7 changed files with 64 additions and 51 deletions
@@ -79,7 +79,7 @@ class SingleAbstractMethodLowering(val context: CommonBackendContext) : ClassLow
// the `irDelegatingConstructorCall` in the constructor below would need to be modified.
assert(superClass.kind == ClassKind.INTERFACE) { "SAM conversion to an abstract class not allowed" }
val superClassName = superClass.fqNameSafe.pathSegments().joinToString("_") { it.toString() }
val superClassName = superClass.fqNameWhenAvailable!!.pathSegments().joinToString("_") { it.toString() }
val subclass = buildClass {
// TODO this is not the name some tests (e.g. kt11519) expect
name = Name.identifier("sam\$$superClassName\$${cachedImplementations.size + localImplementations.size}")