Skip to content

Commit 17d4610

Browse files
kunyavskiySpace Team
authored andcommitted
[Tests] Make synthetic accessors dump more friendly
1 parent 8c45ebc commit 17d4610

File tree

65 files changed

+169
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+169
-165
lines changed

compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/dumpKotlinLike.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ data class KotlinLikeDumpOptions(
7070
val normalizeNames: Boolean = false,
7171
val printExpectDeclarations: Boolean = true,
7272
val collapseObjectLiteralBlock: Boolean = false,
73+
val printVariableInitializers: Boolean = true,
7374

7475
/**
7576
* Whether to print member declarations (default: true).
@@ -996,9 +997,11 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
996997
p(declaration.isConst, "const")
997998
declaration.run { printVariable(isVar, normalizedName(variableNameData), type) }
998999

999-
declaration.initializer?.let {
1000-
p.printWithNoIndent(" = ")
1001-
it.accept(this, declaration)
1000+
if (options.printVariableInitializers) {
1001+
declaration.initializer?.let {
1002+
p.printWithNoIndent(" = ")
1003+
it.accept(this, declaration)
1004+
}
10021005
}
10031006
}
10041007

compiler/testData/klib/syntheticAccessors/outerThis/crossFileLeak/leakingOuterThis.accessors.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,33 +68,33 @@ public class Outer
6868
/* FILE package=<root> fileName=main.kt */
6969

7070
public fun box(): String
71-
val usesPublicPropertyOfOuterInInnerL1: String =
71+
val usesPublicPropertyOfOuterInInnerL1: String
7272
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
73-
val usesPrivatePropertyOfOuterInInnerL1: String =
73+
val usesPrivatePropertyOfOuterInInnerL1: String
7474
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
7575
/* ACCESSOR use-site */ access$<get-privatePropertyOfOuter>($this = access$<outer-this-0>($this = this))
76-
val usesPublicFunctionOfOuterInInnerL1: String =
76+
val usesPublicFunctionOfOuterInInnerL1: String
7777
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
78-
val usesPrivateFunctionOfOuterInInnerL1: String =
78+
val usesPrivateFunctionOfOuterInInnerL1: String
7979
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
8080
/* ACCESSOR use-site */ access$privateFunctionOfOuter($this = access$<outer-this-0>($this = this))
81-
val usesPublicPropertyOfOuterInInnerL2: String =
81+
val usesPublicPropertyOfOuterInInnerL2: String
8282
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
83-
val usesPrivatePropertyOfOuterInInnerL2: String =
83+
val usesPrivatePropertyOfOuterInInnerL2: String
8484
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
8585
/* ACCESSOR use-site */ access$<get-privatePropertyOfOuter>($this = access$<outer-this-1>($this = this))
86-
val usesPublicFunctionOfOuterInInnerL2: String =
86+
val usesPublicFunctionOfOuterInInnerL2: String
8787
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
88-
val usesPrivateFunctionOfOuterInInnerL2: String =
88+
val usesPrivateFunctionOfOuterInInnerL2: String
8989
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
9090
/* ACCESSOR use-site */ access$privateFunctionOfOuter($this = access$<outer-this-1>($this = this))
91-
val usesPublicPropertyOfInnerL1InInnerL2: String =
91+
val usesPublicPropertyOfInnerL1InInnerL2: String
9292
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
93-
val usesPrivatePropertyOfInnerL1InInnerL2: String =
93+
val usesPrivatePropertyOfInnerL1InInnerL2: String
9494
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
9595
/* ACCESSOR use-site */ access$<get-privatePropertyOfInnerL1>($this = access$<outer-this-0>($this = this))
96-
val usesPublicFunctionOfInnerL1InInnerL2: String =
96+
val usesPublicFunctionOfInnerL1InInnerL2: String
9797
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
98-
val usesPrivateFunctionOfInnerL1InInnerL2: String =
98+
val usesPrivateFunctionOfInnerL1InInnerL2: String
9999
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
100-
/* ACCESSOR use-site */ access$privateFunctionOfInnerL1($this = access$<outer-this-0>($this = this))
100+
/* ACCESSOR use-site */ access$privateFunctionOfInnerL1($this = access$<outer-this-0>($this = this))

compiler/testData/klib/syntheticAccessors/outerThis/crossFileLeak/leakingOuterThisWithTypeParameters.accessors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ public class Outer<O : Any?>
2323
/* FILE package=<root> fileName=main.kt */
2424

2525
public fun box(): String
26-
val result: String =
26+
val result: String
2727
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
28-
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
28+
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)

compiler/testData/klib/syntheticAccessors/outerThis/crossModuleLeak/leakingOuterThis.accessors.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,33 +70,33 @@ public class Outer
7070
/* FILE package=<root> fileName=main.kt */
7171

7272
public fun box(): String
73-
val usesPublicPropertyOfOuterInInnerL1: String =
73+
val usesPublicPropertyOfOuterInInnerL1: String
7474
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
75-
val usesPrivatePropertyOfOuterInInnerL1: String =
75+
val usesPrivatePropertyOfOuterInInnerL1: String
7676
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
7777
/* ACCESSOR use-site */ access$<get-privatePropertyOfOuter>($this = access$<outer-this-0>($this = this))
78-
val usesPublicFunctionOfOuterInInnerL1: String =
78+
val usesPublicFunctionOfOuterInInnerL1: String
7979
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
80-
val usesPrivateFunctionOfOuterInInnerL1: String =
80+
val usesPrivateFunctionOfOuterInInnerL1: String
8181
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
8282
/* ACCESSOR use-site */ access$privateFunctionOfOuter($this = access$<outer-this-0>($this = this))
83-
val usesPublicPropertyOfOuterInInnerL2: String =
83+
val usesPublicPropertyOfOuterInInnerL2: String
8484
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
85-
val usesPrivatePropertyOfOuterInInnerL2: String =
85+
val usesPrivatePropertyOfOuterInInnerL2: String
8686
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
8787
/* ACCESSOR use-site */ access$<get-privatePropertyOfOuter>($this = access$<outer-this-1>($this = this))
88-
val usesPublicFunctionOfOuterInInnerL2: String =
88+
val usesPublicFunctionOfOuterInInnerL2: String
8989
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
90-
val usesPrivateFunctionOfOuterInInnerL2: String =
90+
val usesPrivateFunctionOfOuterInInnerL2: String
9191
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
9292
/* ACCESSOR use-site */ access$privateFunctionOfOuter($this = access$<outer-this-1>($this = this))
93-
val usesPublicPropertyOfInnerL1InInnerL2: String =
93+
val usesPublicPropertyOfInnerL1InInnerL2: String
9494
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
95-
val usesPrivatePropertyOfInnerL1InInnerL2: String =
95+
val usesPrivatePropertyOfInnerL1InInnerL2: String
9696
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
9797
/* ACCESSOR use-site */ access$<get-privatePropertyOfInnerL1>($this = access$<outer-this-0>($this = this))
98-
val usesPublicFunctionOfInnerL1InInnerL2: String =
98+
val usesPublicFunctionOfInnerL1InInnerL2: String
9999
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
100-
val usesPrivateFunctionOfInnerL1InInnerL2: String =
100+
val usesPrivateFunctionOfInnerL1InInnerL2: String
101101
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
102-
/* ACCESSOR use-site */ access$privateFunctionOfInnerL1($this = access$<outer-this-0>($this = this))
102+
/* ACCESSOR use-site */ access$privateFunctionOfInnerL1($this = access$<outer-this-0>($this = this))

compiler/testData/klib/syntheticAccessors/outerThis/crossModuleLeak/leakingOuterThisWithTypeParameters.accessors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public class Outer<O : Any?>
2525
/* FILE package=<root> fileName=main.kt */
2626

2727
public fun box(): String
28-
val result: String =
28+
val result: String
2929
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
30-
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
30+
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)

compiler/testData/klib/syntheticAccessors/outerThis/singleFile/leakingOuterThisWithTypeParameters.accessors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public class Outer<O : Any?>
1919
/* TARGET declaration */ <this>: InnerL1<I1, O>
2020
/* TARGET declaration */ <this>: Outer<O>
2121
public fun box(): String
22-
val result: String =
22+
val result: String
2323
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
24-
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
24+
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)

compiler/testData/klib/syntheticAccessors/outerThis/singleFile/outerThisUsage.accessors.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,33 +64,33 @@ public class Outer
6464
/* TARGET use-site */ $this.privateFunctionOfOuter()
6565
/* TARGET declaration */ <this>: Outer
6666
public fun box(): String
67-
val usesPublicPropertyOfOuterInInnerL1: String =
67+
val usesPublicPropertyOfOuterInInnerL1: String
6868
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
69-
val usesPrivatePropertyOfOuterInInnerL1: String =
69+
val usesPrivatePropertyOfOuterInInnerL1: String
7070
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
7171
/* ACCESSOR use-site */ access$<get-privatePropertyOfOuter>($this = access$<outer-this-0>($this = this))
72-
val usesPublicFunctionOfOuterInInnerL1: String =
72+
val usesPublicFunctionOfOuterInInnerL1: String
7373
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
74-
val usesPrivateFunctionOfOuterInInnerL1: String =
74+
val usesPrivateFunctionOfOuterInInnerL1: String
7575
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
7676
/* ACCESSOR use-site */ access$privateFunctionOfOuter($this = access$<outer-this-0>($this = this))
77-
val usesPublicPropertyOfOuterInInnerL2: String =
77+
val usesPublicPropertyOfOuterInInnerL2: String
7878
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
79-
val usesPrivatePropertyOfOuterInInnerL2: String =
79+
val usesPrivatePropertyOfOuterInInnerL2: String
8080
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
8181
/* ACCESSOR use-site */ access$<get-privatePropertyOfOuter>($this = access$<outer-this-1>($this = this))
82-
val usesPublicFunctionOfOuterInInnerL2: String =
82+
val usesPublicFunctionOfOuterInInnerL2: String
8383
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
84-
val usesPrivateFunctionOfOuterInInnerL2: String =
84+
val usesPrivateFunctionOfOuterInInnerL2: String
8585
/* ACCESSOR use-site */ access$<outer-this-1>($this = this)
8686
/* ACCESSOR use-site */ access$privateFunctionOfOuter($this = access$<outer-this-1>($this = this))
87-
val usesPublicPropertyOfInnerL1InInnerL2: String =
87+
val usesPublicPropertyOfInnerL1InInnerL2: String
8888
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
89-
val usesPrivatePropertyOfInnerL1InInnerL2: String =
89+
val usesPrivatePropertyOfInnerL1InInnerL2: String
9090
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
9191
/* ACCESSOR use-site */ access$<get-privatePropertyOfInnerL1>($this = access$<outer-this-0>($this = this))
92-
val usesPublicFunctionOfInnerL1InInnerL2: String =
92+
val usesPublicFunctionOfInnerL1InInnerL2: String
9393
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
94-
val usesPrivateFunctionOfInnerL1InInnerL2: String =
94+
val usesPrivateFunctionOfInnerL1InInnerL2: String
9595
/* ACCESSOR use-site */ access$<outer-this-0>($this = this)
96-
/* ACCESSOR use-site */ access$privateFunctionOfInnerL1($this = access$<outer-this-0>($this = this))
96+
/* ACCESSOR use-site */ access$privateFunctionOfInnerL1($this = access$<outer-this-0>($this = this))

compiler/testData/klib/syntheticAccessors/privateMember/crossFilePrivateLeak/leakingCompanionPrivateMethod.accessors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ public class A
1616
/* FILE package=<root> fileName=main.kt */
1717

1818
public fun box(): String
19-
val result: String =
19+
val result: String
2020
/* ACCESSOR use-site */ access$privateMethod($this = Companion)
21-
/* ACCESSOR use-site */ access$privateMethod($this = this)
21+
/* ACCESSOR use-site */ access$privateMethod($this = this)

compiler/testData/klib/syntheticAccessors/privateMember/crossFilePrivateLeak/leakingLateinitIsInitializedFromInternalInline.accessors.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ public class OK
66
private lateinit var o: String?
77
/* TARGET declaration */ private field o: String?
88
/* TARGET declaration */ private fun <get-o>(): String
9-
val tmp: String? = <this>.#o
9+
val tmp: String?
1010
/* TARGET use-site */ <this>.#o
1111
/* TARGET declaration */ private fun <set-o>(<set-?>: String)
1212
/* TARGET use-site */ <this>.#o = <set-?>
1313
public lateinit var k: String?
1414
/* TARGET declaration */ private field k: String?
1515
public fun <get-k>(): String
16-
val tmp: String? = <this>.#k
16+
val tmp: String?
1717
/* TARGET use-site */ <this>.#k
1818
public fun <set-k>(<set-?>: String)
1919
/* TARGET use-site */ <this>.#k = <set-?>
@@ -58,4 +58,4 @@ public fun box(): String
5858
/* ACCESSOR use-site */ access$<get-k>$p($this = this)
5959
/* ACCESSOR use-site */ access$<get-k>$p($this = this)
6060
/* LOCAL use-site @1 */ <anonymous object>.run()
61-
/* ACCESSOR use-site */ access$<get-o>($this = this)
61+
/* ACCESSOR use-site */ access$<get-o>($this = this)

compiler/testData/klib/syntheticAccessors/privateMember/crossFilePrivateLeak/leakingPrivateConstructorThroughObjectInInternalInlineFun.accessors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public open class A
1616
/* FILE package=<root> fileName=main.kt */
1717

1818
public fun box(): String
19-
val result: Long =
19+
val result: Long
2020
/* LOCAL declaration @0 */ local class <no name provided> : A
2121
/* LOCAL declaration @1 */ public constructor() /* primary */
2222
/* ACCESSOR use-site */ A(x = this.<get-x>().toInt().plus(other = 1), $constructor_marker = null)

0 commit comments

Comments
 (0)