[IR] Don't print flags in declaration references in irText tests

This doesn't reduce the quality of tests, because the flags are still
printed for declarations themselves. We only omit them in references.

However, this makes the tests more compatible with non-JVM backends
(see KT-58605), because flags of referenced stdlib declarations may
differ among target platforms.
This commit is contained in:
Sergej Jaskiewicz
2023-05-15 19:44:19 +02:00
committed by Space Team
parent b8e868caf6
commit fd76a34277
837 changed files with 11643 additions and 11646 deletions
@@ -50,12 +50,15 @@ fun IrFile.dumpTreesFromLineNumber(lineNumber: Int, options: DumpIrTreeOptions =
* @property verboseErrorTypes Whether to dump the value of [IrErrorType.kotlinType] for [IrErrorType] nodes
* @property printFacadeClassInFqNames Whether printed fully-qualified names of top-level declarations should include the name of
* the file facade class (see [IrDeclarationOrigin.FILE_CLASS])
* @property printFlagsInDeclarationReferences If `false`, flags like `fake_override`, `inline` etc. are not printed in rendered declaration
* references.
*/
data class DumpIrTreeOptions(
val normalizeNames: Boolean = false,
val stableOrder: Boolean = false,
val verboseErrorTypes: Boolean = true,
val printFacadeClassInFqNames: Boolean = true,
val printFlagsInDeclarationReferences: Boolean = true,
)
private fun IrFile.shouldSkipDump(): Boolean {
@@ -86,7 +86,9 @@ class RenderIrElementVisitor(private val options: DumpIrTreeOptions = DumpIrTree
append(declaration.type.renderTypeWithRenderer(null, options))
append(' ')
append(declaration.renderVariableFlags())
if (options.printFlagsInDeclarationReferences) {
append(declaration.renderVariableFlags())
}
renderDeclaredIn(declaration)
}
@@ -98,7 +100,9 @@ class RenderIrElementVisitor(private val options: DumpIrTreeOptions = DumpIrTree
append(declaration.type.renderTypeWithRenderer(null, options))
append(' ')
append(declaration.renderValueParameterFlags())
if (options.printFlagsInDeclarationReferences) {
append(declaration.renderValueParameterFlags())
}
renderDeclaredIn(declaration)
}
@@ -144,9 +148,11 @@ class RenderIrElementVisitor(private val options: DumpIrTreeOptions = DumpIrTree
}
append(' ')
when (declaration) {
is IrSimpleFunction -> append(declaration.renderSimpleFunctionFlags())
is IrConstructor -> append(declaration.renderConstructorFlags())
if (options.printFlagsInDeclarationReferences) {
when (declaration) {
is IrSimpleFunction -> append(declaration.renderSimpleFunctionFlags())
is IrConstructor -> append(declaration.renderConstructorFlags())
}
}
renderDeclaredIn(declaration)
@@ -179,8 +185,10 @@ class RenderIrElementVisitor(private val options: DumpIrTreeOptions = DumpIrTree
append(type.renderTypeWithRenderer(null, options))
}
append(' ')
append(declaration.renderPropertyFlags())
if (options.printFlagsInDeclarationReferences) {
append(' ')
append(declaration.renderPropertyFlags())
}
}
override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty, data: Nothing?): String =