Skip to content

Commit ce2560d

Browse files
committed
Remove RenameLifted phase
This phase was added to compensate for limitations of the unique names implementation. Local fresh names where numbered globally, now they are numbered by compilation unit. Fixes #12759
1 parent c041327 commit ce2560d

File tree

13 files changed

+71
-64
lines changed

13 files changed

+71
-64
lines changed

compiler/src/dotty/tools/dotc/Compiler.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ class Compiler {
126126
List(new DropOuterAccessors, // Drop unused outer accessors
127127
new CheckNoSuperThis, // Check that supercalls don't contain references to `this`
128128
new Flatten, // Lift all inner classes to package scope
129-
new RenameLifted, // Renames lifted classes to local numbering scheme
130129
new TransformWildcards, // Replace wildcards with default values
131130
new MoveStatics, // Move static methods from companion to the class itself
132131
new ExpandPrivate, // Widen private definitions accessed from nested classes

compiler/src/dotty/tools/dotc/transform/RenameLifted.scala

Lines changed: 0 additions & 46 deletions
This file was deleted.

tests/run/i12759.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package example {
2+
3+
trait Foo {
4+
val (a2, a3) = ("", "")
5+
val (x1, x2, x3) = ("", "", "")
6+
}
7+
8+
class A extends Foo
9+
}
10+
11+
object Test {
12+
def main(args: Array[String]): Unit = {
13+
new example.A
14+
}
15+
}

tests/run/i12759b.scala

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package example {
2+
3+
class A1
4+
class A2
5+
class A3
6+
7+
class TypeClass[A](val value: A)
8+
9+
object TypeClass {
10+
def apply[A](implicit a: TypeClass[A]): TypeClass[A] = a
11+
12+
def get2[X1: TypeClass, X2: TypeClass]: (X1, X2) = {
13+
(TypeClass[X1].value, TypeClass[X2].value)
14+
}
15+
16+
def get3[X1: TypeClass, X2: TypeClass, X3: TypeClass]: (X1, X2, X3) = {
17+
(TypeClass[X1].value, TypeClass[X2].value, TypeClass[X3].value)
18+
}
19+
20+
implicit def a1: TypeClass[A1] = new TypeClass[A1](new A1)
21+
implicit def a2: TypeClass[A2] = new TypeClass[A2](new A2)
22+
implicit def a3: TypeClass[A3] = new TypeClass[A3](new A3)
23+
}
24+
25+
trait Foo {
26+
27+
val (a2, a3) = TypeClass.get2[A2, A3]
28+
29+
val (x1, x2, x3) = TypeClass.get3[A1, A2, A3]
30+
31+
}
32+
33+
}
34+
35+
object Test {
36+
def main(args: Array[String]): Unit = {
37+
new example.Foo {}
38+
}
39+
}

tests/run/i2738.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Test$qux$1$
21
Test$qux$2$
2+
Test$qux$4$
33
bar$1
44
bar$2

tests/run/i2964.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class Foo$$anon$1
2-
class Bar$$anon$1
32
class Bar$$anon$2
4-
class Baz$$anon$1
3+
class Bar$$anon$3
4+
class Baz$$anon$4

tests/run/i2964b.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class Foo$$anon$1
2-
class Bar$$anon$1
32
class Bar$$anon$2
4-
class Baz$$anon$1
3+
class Bar$$anon$3
4+
class Baz$$anon$4

tests/run/i2964c.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class Foo$Inner$1
2-
class Bar$Inner$1
32
class Bar$Inner$2
4-
class Baz$Inner$1
3+
class Bar$Inner$3
4+
class Baz$Inner$4

tests/run/i2964d.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class Foo$Inner$1$
2-
class Bar$Inner$1$
3-
class Bar$Inner$2$
4-
class Baz$Inner$1$
1+
class Foo$Inner$2$
2+
class Bar$Inner$4$
3+
class Bar$Inner$6$
4+
class Baz$Inner$8$

tests/run/i2964e.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class foo.bar.Foo$$anon$1
22
class foo.bar.Foo$$anon$2
3-
class foo.Foo$$anon$1
4-
class Foo$$anon$1
3+
class foo.Foo$$anon$3
4+
class Foo$$anon$4

tests/run/i3000b.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Foo$$anon$1
2-
bar.Bar$$anon$1
2+
bar.Bar$$anon$2

tests/run/i3006.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
f$1
22
f$2
33
f$3
4-
f$1
5-
f$2
4+
f$4
5+
f$5

tests/run/i3006b.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
bar$1
22
bar$2
3-
bar$1
3+
bar$3

0 commit comments

Comments
 (0)