JVM IR: fix another naming inconsistency with old backend

This fixes slice rewrite stacktraces from RecordNamesForKotlinTypeMapper
which are printed out when running some JVM IR tests (even though
they're ignored), e.g. localClassSimpleName.kt
This commit is contained in:
Alexander Udalov
2019-08-26 12:15:25 +02:00
parent fec8dbf6df
commit fbe66c3496
2 changed files with 6 additions and 1 deletions
@@ -107,6 +107,12 @@ class InventNamesForLocalClasses(private val context: JvmBackendContext) : FileL
localFunctionNames[(declaration as IrFunction).symbol] = name
}
}
declaration is IrFunction && declaration.parent !is IrClass -> {
// In the old backend, only names of non-local functions are stored in names of anonymous classes. All other names
// are replaced with indices. For example, a local class `L` in a top-level function `f` will have the name `...$f$L`,
// but inside a local function `g` (which is in `f`) it will have the name `...$f$1$L` (_not_ `...$f$g$L`).
inventName(null, data)
}
enclosingName != null -> "$enclosingName$$simpleName"
else -> simpleName
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun foo() {
fun bar() : (Int) -> Unit {
return {