From c602c51642494f3d3ea52db777ebe7df5d73c26d Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Mon, 5 Feb 2018 16:11:03 +0300 Subject: [PATCH] Slicer: Sort tree nodes to produce stable test data --- .../diamondHierarchyJKRootInterfaceFun.results.txt | 2 +- .../inflow/funParamererWithDefault.results.txt | 2 +- .../slicer/inflow/nonLocalReturn.results.txt | 2 +- .../inflow/nullsAndNotNulls.nullnessGroups.txt | 11 ++++++----- .../inflow/overridingFunctionResult.results.txt | 2 +- .../slicer/inflow/overridingParameter.results.txt | 2 +- .../overridingPropertyGetterResult.results.txt | 2 +- .../inflow/overridingPropertyResult.results.txt | 2 +- .../inflow/primaryConstructorParameter.results.txt | 12 ++++++------ ...maryConstructorParameterWithDefault.results.txt | 6 +++--- .../secondaryConstructorParameter.results.txt | 12 ++++++------ ...daryConstructorParameterWithDefault.results.txt | 6 +++--- .../testData/slicer/inflow/topLevelVar.results.txt | 2 +- .../slicer/inflow/valParameter.results.txt | 4 ++-- .../slicer/inflow/varParameter.results.txt | 6 +++--- ...aultExplicitPrimaryConstructorCalls.results.txt | 10 +++++----- .../diamondHierarchyJKLeafClassFun.results.txt | 14 +++++++------- .../diamondHierarchyJKMiddleClassFun.results.txt | 6 +++--- ...iamondHierarchyJKMiddleInterfaceFun.results.txt | 6 +++--- .../diamondHierarchyLeafClassFun.results.txt | 4 ++-- .../diamondHierarchyMiddleClassFun.results.txt | 4 ++-- .../diamondHierarchyMiddleInterfaceFun.results.txt | 4 ++-- .../outflow/overridingFunctionResult.results.txt | 4 ++-- .../overridingFunctionResultWithJava.results.txt | 6 +++--- .../slicer/outflow/overridingParameter.results.txt | 4 ++-- .../overridingPropertyGetterResult.results.txt | 4 ++-- .../outflow/overridingPropertyResult.results.txt | 4 ++-- .../outflow/primaryConstructorCalls.results.txt | 8 ++++---- .../outflow/secondaryConstructorCalls.results.txt | 8 ++++---- .../outflow/topLevelPropertyUsages.results.txt | 2 +- .../kotlin/idea/slicer/AbstractSlicerTest.kt | 8 ++++++-- 31 files changed, 87 insertions(+), 82 deletions(-) diff --git a/idea/testData/slicer/inflow/diamondHierarchyJKRootInterfaceFun.results.txt b/idea/testData/slicer/inflow/diamondHierarchyJKRootInterfaceFun.results.txt index 96bce28dea5..f485b80aa22 100644 --- a/idea/testData/slicer/inflow/diamondHierarchyJKRootInterfaceFun.results.txt +++ b/idea/testData/slicer/inflow/diamondHierarchyJKRootInterfaceFun.results.txt @@ -2,5 +2,5 @@ 8 val x = a.foo() 4 fun foo() = 1 4 fun foo() = 1 -13 return 4; 3 return 2; +13 return 4; diff --git a/idea/testData/slicer/inflow/funParamererWithDefault.results.txt b/idea/testData/slicer/inflow/funParamererWithDefault.results.txt index 948987294be..d2696c7380b 100644 --- a/idea/testData/slicer/inflow/funParamererWithDefault.results.txt +++ b/idea/testData/slicer/inflow/funParamererWithDefault.results.txt @@ -1,7 +1,7 @@ 4 fun foo(n: Int, s: String = "???") { -4 FunParamererWithDefaultKt.foo(1, "2"): 4 fun foo(n: Int, s: String = "???") { 10 foo(1, "2") +4 FunParamererWithDefaultKt.foo(1, "2"): 11 foo(1, s = "2") 12 foo(n = 1, s = "2") 13 foo(s = "2", n = 1) diff --git a/idea/testData/slicer/inflow/nonLocalReturn.results.txt b/idea/testData/slicer/inflow/nonLocalReturn.results.txt index 2eed9483cc8..18a78688da2 100644 --- a/idea/testData/slicer/inflow/nonLocalReturn.results.txt +++ b/idea/testData/slicer/inflow/nonLocalReturn.results.txt @@ -1,5 +1,4 @@ 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } -5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) @@ -9,3 +8,4 @@ 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } +5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } diff --git a/idea/testData/slicer/inflow/nullsAndNotNulls.nullnessGroups.txt b/idea/testData/slicer/inflow/nullsAndNotNulls.nullnessGroups.txt index 70410530241..83a482fd744 100644 --- a/idea/testData/slicer/inflow/nullsAndNotNulls.nullnessGroups.txt +++ b/idea/testData/slicer/inflow/nullsAndNotNulls.nullnessGroups.txt @@ -6,13 +6,14 @@ 7 else -> null [NotNull Values] -6 n < 0 -> "-" -9 return s -4 var s = when { -4 var s = when { -6 n < 0 -> "-" 5 n > 0 -> "+" 9 return s 4 var s = when { 4 var s = when { 5 n > 0 -> "+" +6 n < 0 -> "-" +9 return s +4 var s = when { +4 var s = when { +6 n < 0 -> "-" + diff --git a/idea/testData/slicer/inflow/overridingFunctionResult.results.txt b/idea/testData/slicer/inflow/overridingFunctionResult.results.txt index 76e79b52a01..3739d4f7fec 100644 --- a/idea/testData/slicer/inflow/overridingFunctionResult.results.txt +++ b/idea/testData/slicer/inflow/overridingFunctionResult.results.txt @@ -1,7 +1,7 @@ 17 val y = b.foo() 17 val y = b.foo() +3 return 5; 8 override fun foo() = 2 8 override fun foo() = 2 -3 return 5; 12 override fun foo() = 3 12 override fun foo() = 3 diff --git a/idea/testData/slicer/inflow/overridingParameter.results.txt b/idea/testData/slicer/inflow/overridingParameter.results.txt index c1091a54113..c908a595eb8 100644 --- a/idea/testData/slicer/inflow/overridingParameter.results.txt +++ b/idea/testData/slicer/inflow/overridingParameter.results.txt @@ -1,6 +1,6 @@ 15 val y = b.foo 15 val y = b.foo -7 open class B(override val foo: Int) : A() 3 return 5; +7 open class B(override val foo: Int) : A() 10 override val foo = 3 10 override val foo = 3 diff --git a/idea/testData/slicer/inflow/overridingPropertyGetterResult.results.txt b/idea/testData/slicer/inflow/overridingPropertyGetterResult.results.txt index bcca29baaab..56cfb35aca3 100644 --- a/idea/testData/slicer/inflow/overridingPropertyGetterResult.results.txt +++ b/idea/testData/slicer/inflow/overridingPropertyGetterResult.results.txt @@ -1,7 +1,7 @@ 20 val y = b.foo 20 val y = b.foo +3 return 5; 9 override val foo: Int 10 get() = 2 -3 return 5; 14 override val foo: Int 15 get() = 3 diff --git a/idea/testData/slicer/inflow/overridingPropertyResult.results.txt b/idea/testData/slicer/inflow/overridingPropertyResult.results.txt index da9b7e25d58..df8d6a2152b 100644 --- a/idea/testData/slicer/inflow/overridingPropertyResult.results.txt +++ b/idea/testData/slicer/inflow/overridingPropertyResult.results.txt @@ -1,7 +1,7 @@ 17 val y = b.foo 17 val y = b.foo +3 return 5; 8 override val foo = 2 8 override val foo = 2 -3 return 5; 12 override val foo = 3 12 override val foo = 3 diff --git a/idea/testData/slicer/inflow/primaryConstructorParameter.results.txt b/idea/testData/slicer/inflow/primaryConstructorParameter.results.txt index 0d0831b062b..8e05806b9ba 100644 --- a/idea/testData/slicer/inflow/primaryConstructorParameter.results.txt +++ b/idea/testData/slicer/inflow/primaryConstructorParameter.results.txt @@ -1,17 +1,17 @@ 3 open class A @JvmOverloads constructor(n: Int, s: String = "???") +3 super(n, s); +2 D(int n, String s) { 5 class B1: A(1) +7 super(n); +6 D(int n) { 6 class B2: A(1, "2") 7 class B3: A(1, s = "2") +11 new A(1); 8 class B4: A(n = 1, s = "2") +12 new A(1, "2"); 9 class B5: A(s = "2", n = 1) 12 A(1) 13 A(1, "2") 14 A(1, s = "2") 15 A(n = 1, s = "2") 16 A(s = "2", n = 1) -3 super(n, s); -2 D(int n, String s) { -7 super(n); -6 D(int n) { -11 new A(1); -12 new A(1, "2"); diff --git a/idea/testData/slicer/inflow/primaryConstructorParameterWithDefault.results.txt b/idea/testData/slicer/inflow/primaryConstructorParameterWithDefault.results.txt index 83865a19342..56c16a150d9 100644 --- a/idea/testData/slicer/inflow/primaryConstructorParameterWithDefault.results.txt +++ b/idea/testData/slicer/inflow/primaryConstructorParameterWithDefault.results.txt @@ -1,13 +1,13 @@ 3 open class A @JvmOverloads constructor(n: Int, s: String = "???") +3 super(n, s); +2 D(int n, String s) { 3 open class A @JvmOverloads constructor(n: Int, s: String = "???") 6 class B2: A(1, "2") 7 class B3: A(1, s = "2") 8 class B4: A(n = 1, s = "2") +12 new A(1, "2"); 9 class B5: A(s = "2", n = 1) 13 A(1, "2") 14 A(1, s = "2") 15 A(n = 1, s = "2") 16 A(s = "2", n = 1) -3 super(n, s); -2 D(int n, String s) { -12 new A(1, "2"); diff --git a/idea/testData/slicer/inflow/secondaryConstructorParameter.results.txt b/idea/testData/slicer/inflow/secondaryConstructorParameter.results.txt index 9f4e3cb9b86..c2d239a6067 100644 --- a/idea/testData/slicer/inflow/secondaryConstructorParameter.results.txt +++ b/idea/testData/slicer/inflow/secondaryConstructorParameter.results.txt @@ -1,17 +1,17 @@ 4 @JvmOverloads constructor(n: Int, s: String = "???") +3 super(n, s); +2 D(int n, String s) { 7 class B1: A(1) +7 super(n); +6 D(int n) { 8 class B2: A(1, "2") 9 class B3: A(1, s = "2") +11 new A(1); 10 class B4: A(n = 1, s = "2") +12 new A(1, "2"); 11 class B5: A(s = "2", n = 1) 14 A(1) 15 A(1, "2") 16 A(1, s = "2") 17 A(n = 1, s = "2") 18 A(s = "2", n = 1) -3 super(n, s); -2 D(int n, String s) { -7 super(n); -6 D(int n) { -11 new A(1); -12 new A(1, "2"); diff --git a/idea/testData/slicer/inflow/secondaryConstructorParameterWithDefault.results.txt b/idea/testData/slicer/inflow/secondaryConstructorParameterWithDefault.results.txt index aa79f112beb..909d1d6801e 100644 --- a/idea/testData/slicer/inflow/secondaryConstructorParameterWithDefault.results.txt +++ b/idea/testData/slicer/inflow/secondaryConstructorParameterWithDefault.results.txt @@ -1,13 +1,13 @@ 4 @JvmOverloads constructor(n: Int, s: String = "???") +3 super(n, s); +2 D(int n, String s) { 4 @JvmOverloads constructor(n: Int, s: String = "???") 8 class B2: A(1, "2") 9 class B3: A(1, s = "2") +12 new A(1, "2"); 10 class B4: A(n = 1, s = "2") 11 class B5: A(s = "2", n = 1) 15 A(1, "2") 16 A(1, s = "2") 17 A(n = 1, s = "2") 18 A(s = "2", n = 1) -3 super(n, s); -2 D(int n, String s) { -12 new A(1, "2"); diff --git a/idea/testData/slicer/inflow/topLevelVar.results.txt b/idea/testData/slicer/inflow/topLevelVar.results.txt index 6b1fde030f6..5df12d4edbb 100644 --- a/idea/testData/slicer/inflow/topLevelVar.results.txt +++ b/idea/testData/slicer/inflow/topLevelVar.results.txt @@ -1,4 +1,4 @@ 3 var foo: Int = 1 3 var foo: Int = 1 -4 TopLevelVarKt.setFoo(3); 7 foo = 2 +4 TopLevelVarKt.setFoo(3); diff --git a/idea/testData/slicer/inflow/valParameter.results.txt b/idea/testData/slicer/inflow/valParameter.results.txt index 9e8178e9d8e..a1d7fbabba4 100644 --- a/idea/testData/slicer/inflow/valParameter.results.txt +++ b/idea/testData/slicer/inflow/valParameter.results.txt @@ -1,6 +1,6 @@ 3 open class A(val n: Int) -5 class B : A(1) -8 val z = A(2).n 3 super(n); 2 D(int n) { +5 class B : A(1) +8 val z = A(2).n 7 A a = new A(3); diff --git a/idea/testData/slicer/inflow/varParameter.results.txt b/idea/testData/slicer/inflow/varParameter.results.txt index 37be43b53dd..a0222366b0f 100644 --- a/idea/testData/slicer/inflow/varParameter.results.txt +++ b/idea/testData/slicer/inflow/varParameter.results.txt @@ -1,10 +1,10 @@ 3 open class A(var n: Int) { -20 class B : A(1) -23 val z = A(2).n -24 A(3).n = 2 3 super(n); 2 D(int n) { 7 A a = new A(3); 9 a.setN(4); 16 n = 1 +20 class B : A(1) +23 val z = A(2).n +24 A(3).n = 2 24 A(3).n = 2 diff --git a/idea/testData/slicer/outflow/defaultExplicitPrimaryConstructorCalls.results.txt b/idea/testData/slicer/outflow/defaultExplicitPrimaryConstructorCalls.results.txt index dab25e3649c..94f004deac5 100644 --- a/idea/testData/slicer/outflow/defaultExplicitPrimaryConstructorCalls.results.txt +++ b/idea/testData/slicer/outflow/defaultExplicitPrimaryConstructorCalls.results.txt @@ -1,9 +1,9 @@ 3 open class A() { +2 J() { +4 constructor(n: Int) : this() +7 super(); 7 class B : A() +11 A a = new A(); +10 constructor() : super() 14 val x = A() 14 val x = A() -2 J() { -7 super(); -4 constructor(n: Int) : this() -10 constructor() : super() -11 A a = new A(); diff --git a/idea/testData/slicer/outflow/diamondHierarchyJKLeafClassFun.results.txt b/idea/testData/slicer/outflow/diamondHierarchyJKLeafClassFun.results.txt index a36ff0bae52..54c3da0171b 100644 --- a/idea/testData/slicer/outflow/diamondHierarchyJKLeafClassFun.results.txt +++ b/idea/testData/slicer/outflow/diamondHierarchyJKLeafClassFun.results.txt @@ -1,7 +1,5 @@ 4 override fun foo() = 4 4 override fun foo() = 4 -11 val u = d.foo() -11 val u = d.foo() 2 public int foo(); 8 val x = a.foo() 8 val x = a.foo() @@ -9,14 +7,16 @@ 9 val y = b.foo() 10 val z = c.foo() 10 val z = c.foo() -11 DUPLICATE: val u = d.foo() +11 val u = d.foo() +11 val u = d.foo() 6 public int foo() { -9 DUPLICATE: val y = b.foo() -11 DUPLICATE: val u = d.foo() 8 DUPLICATE: val x = a.foo() +9 DUPLICATE: val y = b.foo() 10 DUPLICATE: val z = c.foo() +11 DUPLICATE: val u = d.foo() 12 public int foo(); -10 DUPLICATE: val z = c.foo() -11 DUPLICATE: val u = d.foo() 8 DUPLICATE: val x = a.foo() 9 DUPLICATE: val y = b.foo() +10 DUPLICATE: val z = c.foo() +11 DUPLICATE: val u = d.foo() +11 DUPLICATE: val u = d.foo() diff --git a/idea/testData/slicer/outflow/diamondHierarchyJKMiddleClassFun.results.txt b/idea/testData/slicer/outflow/diamondHierarchyJKMiddleClassFun.results.txt index 86b1b43cf19..a9c28a48135 100644 --- a/idea/testData/slicer/outflow/diamondHierarchyJKMiddleClassFun.results.txt +++ b/idea/testData/slicer/outflow/diamondHierarchyJKMiddleClassFun.results.txt @@ -1,12 +1,12 @@ 4 override fun foo() = 2 4 override fun foo() = 2 -9 val y = b.foo() -9 val y = b.foo() 4 public int foo(); 8 val x = a.foo() 8 val x = a.foo() +9 val y = b.foo() +9 val y = b.foo() 10 val z = c.foo() 10 val z = c.foo() 11 val u = d.foo() 11 val u = d.foo() -9 DUPLICATE: val y = b.foo() +9 DUPLICATE: val y = b.foo() diff --git a/idea/testData/slicer/outflow/diamondHierarchyJKMiddleInterfaceFun.results.txt b/idea/testData/slicer/outflow/diamondHierarchyJKMiddleInterfaceFun.results.txt index f9d7b4b34a9..d57a2627a9f 100644 --- a/idea/testData/slicer/outflow/diamondHierarchyJKMiddleInterfaceFun.results.txt +++ b/idea/testData/slicer/outflow/diamondHierarchyJKMiddleInterfaceFun.results.txt @@ -1,12 +1,12 @@ 4 override fun foo() = 3 4 override fun foo() = 3 -10 val z = c.foo() -10 val z = c.foo() 2 public int foo(); 8 val x = a.foo() 8 val x = a.foo() 9 val y = b.foo() 9 val y = b.foo() +10 val z = c.foo() +10 val z = c.foo() 11 val u = d.foo() 11 val u = d.foo() -10 DUPLICATE: val z = c.foo() +10 DUPLICATE: val z = c.foo() diff --git a/idea/testData/slicer/outflow/diamondHierarchyLeafClassFun.results.txt b/idea/testData/slicer/outflow/diamondHierarchyLeafClassFun.results.txt index 9047ae88c8a..9c48ea76332 100644 --- a/idea/testData/slicer/outflow/diamondHierarchyLeafClassFun.results.txt +++ b/idea/testData/slicer/outflow/diamondHierarchyLeafClassFun.results.txt @@ -1,10 +1,10 @@ 16 override fun foo() = 4 16 override fun foo() = 4 -23 val u = d.foo() -23 val u = d.foo() 20 val x = a.foo() 20 val x = a.foo() 21 val y = b.foo() 21 val y = b.foo() 22 val z = c.foo() 22 val z = c.foo() +23 val u = d.foo() +23 val u = d.foo() diff --git a/idea/testData/slicer/outflow/diamondHierarchyMiddleClassFun.results.txt b/idea/testData/slicer/outflow/diamondHierarchyMiddleClassFun.results.txt index 45faf4b362e..63905fff14c 100644 --- a/idea/testData/slicer/outflow/diamondHierarchyMiddleClassFun.results.txt +++ b/idea/testData/slicer/outflow/diamondHierarchyMiddleClassFun.results.txt @@ -1,6 +1,6 @@ 8 override fun foo() = 2 8 override fun foo() = 2 -21 val y = b.foo() -21 val y = b.foo() 20 val x = a.foo() 20 val x = a.foo() +21 val y = b.foo() +21 val y = b.foo() diff --git a/idea/testData/slicer/outflow/diamondHierarchyMiddleInterfaceFun.results.txt b/idea/testData/slicer/outflow/diamondHierarchyMiddleInterfaceFun.results.txt index da400632924..7d63f48ac4f 100644 --- a/idea/testData/slicer/outflow/diamondHierarchyMiddleInterfaceFun.results.txt +++ b/idea/testData/slicer/outflow/diamondHierarchyMiddleInterfaceFun.results.txt @@ -1,6 +1,6 @@ 12 override fun foo() = 3 12 override fun foo() = 3 -22 val z = c.foo() -22 val z = c.foo() 20 val x = a.foo() 20 val x = a.foo() +22 val z = c.foo() +22 val z = c.foo() diff --git a/idea/testData/slicer/outflow/overridingFunctionResult.results.txt b/idea/testData/slicer/outflow/overridingFunctionResult.results.txt index efec88b3a9e..4ba765789a2 100644 --- a/idea/testData/slicer/outflow/overridingFunctionResult.results.txt +++ b/idea/testData/slicer/outflow/overridingFunctionResult.results.txt @@ -1,6 +1,6 @@ 8 override fun foo() = 2 8 override fun foo() = 2 -17 val y = b.foo() -17 val y = b.foo() 16 val x = a.foo() 16 val x = a.foo() +17 val y = b.foo() +17 val y = b.foo() diff --git a/idea/testData/slicer/outflow/overridingFunctionResultWithJava.results.txt b/idea/testData/slicer/outflow/overridingFunctionResultWithJava.results.txt index ef191709ab7..c8e20eb4566 100644 --- a/idea/testData/slicer/outflow/overridingFunctionResultWithJava.results.txt +++ b/idea/testData/slicer/outflow/overridingFunctionResultWithJava.results.txt @@ -1,10 +1,10 @@ 4 override fun foo() = 2 4 override fun foo() = 2 -9 val y = b.foo() -9 val y = b.foo() 2 int foo() { 8 val x = a.foo() 8 val x = a.foo() +9 val y = b.foo() +9 val y = b.foo() 10 val z = c.foo() 10 val z = c.foo() -9 DUPLICATE: val y = b.foo() +9 DUPLICATE: val y = b.foo() diff --git a/idea/testData/slicer/outflow/overridingParameter.results.txt b/idea/testData/slicer/outflow/overridingParameter.results.txt index aae9d7c88f7..e178334487a 100644 --- a/idea/testData/slicer/outflow/overridingParameter.results.txt +++ b/idea/testData/slicer/outflow/overridingParameter.results.txt @@ -1,8 +1,8 @@ 10 override val foo = 3 10 override val foo = 3 -16 val z = c.foo -16 val z = c.foo 14 val x = a.foo 14 val x = a.foo 15 val y = b.foo 15 val y = b.foo +16 val z = c.foo +16 val z = c.foo diff --git a/idea/testData/slicer/outflow/overridingPropertyGetterResult.results.txt b/idea/testData/slicer/outflow/overridingPropertyGetterResult.results.txt index dd4132f00d7..805baf2d53d 100644 --- a/idea/testData/slicer/outflow/overridingPropertyGetterResult.results.txt +++ b/idea/testData/slicer/outflow/overridingPropertyGetterResult.results.txt @@ -1,6 +1,6 @@ 10 get() = 2 10 get() = 2 -20 val y = b.foo -20 val y = b.foo 19 val x = a.foo 19 val x = a.foo +20 val y = b.foo +20 val y = b.foo diff --git a/idea/testData/slicer/outflow/overridingPropertyResult.results.txt b/idea/testData/slicer/outflow/overridingPropertyResult.results.txt index 34d5b88651d..1924d92d93b 100644 --- a/idea/testData/slicer/outflow/overridingPropertyResult.results.txt +++ b/idea/testData/slicer/outflow/overridingPropertyResult.results.txt @@ -1,6 +1,6 @@ 8 override val foo = 2 8 override val foo = 2 -17 val y = b.foo -17 val y = b.foo 16 val x = a.foo 16 val x = a.foo +17 val y = b.foo +17 val y = b.foo diff --git a/idea/testData/slicer/outflow/primaryConstructorCalls.results.txt b/idea/testData/slicer/outflow/primaryConstructorCalls.results.txt index 321f048ddd4..4460c75f647 100644 --- a/idea/testData/slicer/outflow/primaryConstructorCalls.results.txt +++ b/idea/testData/slicer/outflow/primaryConstructorCalls.results.txt @@ -1,8 +1,8 @@ 3 open class A(n: Int) { -7 class B : A(1) -14 val x = A(1) -14 val x = A(1) 3 super(1); 4 constructor() : this(1) -10 constructor() : super(1) +7 class B : A(1) 7 A a = new A(1); +10 constructor() : super(1) +14 val x = A(1) +14 val x = A(1) diff --git a/idea/testData/slicer/outflow/secondaryConstructorCalls.results.txt b/idea/testData/slicer/outflow/secondaryConstructorCalls.results.txt index bbc817cf473..110efd95969 100644 --- a/idea/testData/slicer/outflow/secondaryConstructorCalls.results.txt +++ b/idea/testData/slicer/outflow/secondaryConstructorCalls.results.txt @@ -1,8 +1,8 @@ 4 constructor(n: Int) -9 class B : A(1) -16 val x = A(1) -16 val x = A(1) 3 super(1); 6 constructor() : this(1) -12 constructor() : super(1) 7 A a = new A(1); +9 class B : A(1) +12 constructor() : super(1) +16 val x = A(1) +16 val x = A(1) diff --git a/idea/testData/slicer/outflow/topLevelPropertyUsages.results.txt b/idea/testData/slicer/outflow/topLevelPropertyUsages.results.txt index 3ee47b7c38b..ec9bcde018a 100644 --- a/idea/testData/slicer/outflow/topLevelPropertyUsages.results.txt +++ b/idea/testData/slicer/outflow/topLevelPropertyUsages.results.txt @@ -1,7 +1,7 @@ 3 val x = 1 -3 int x = TopLevelPropertyUsagesKt.getX(); 5 val y = x 5 val y = x +3 int x = TopLevelPropertyUsagesKt.getX(); 8 val y = x 8 val y = x 13 z = x diff --git a/idea/tests/org/jetbrains/kotlin/idea/slicer/AbstractSlicerTest.kt b/idea/tests/org/jetbrains/kotlin/idea/slicer/AbstractSlicerTest.kt index 1348e1d39a1..cd45ad39c84 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/slicer/AbstractSlicerTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/slicer/AbstractSlicerTest.kt @@ -27,6 +27,7 @@ import com.intellij.slicer.SliceRootNode import com.intellij.usages.TextChunk import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.test.KotlinTestUtils import java.awt.Font @@ -46,6 +47,9 @@ abstract class AbstractSlicerTest : KotlinLightCodeInsightFixtureTestCase() { } companion object { + private val SliceNode.sortedChildren : List + get() = children.sortedBy { it.value.element?.startOffset ?: -1 } + @JvmStatic protected fun buildTreeRepresentation(rootNode: SliceNode): String { fun TextChunk.render(): String { @@ -67,7 +71,7 @@ abstract class AbstractSlicerTest : KotlinLightCodeInsightFixtureTestCase() { return buildString { when { node is SliceRootNode && usage.element is KtFile -> { - node.children.forEach { append(process(it, indent)) } + node.sortedChildren.forEach { append(process(it, indent)) } return@buildString } // SliceLeafValueClassNode is package-private @@ -92,7 +96,7 @@ abstract class AbstractSlicerTest : KotlinLightCodeInsightFixtureTestCase() { } if (!isDuplicated) { - node.children.forEach { append(process(it, indent + 1)) } + node.sortedChildren.forEach { append(process(it, indent + 1)) } } }.replace(Regex(""), "") }