Skip to content

Commit 693e716

Browse files
committed
Drop $$local whan mangling fields
1 parent 83da57a commit 693e716

7 files changed

+18
-16
lines changed

compiler/src/dotty/tools/dotc/core/NameKinds.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ object NameKinds {
351351
val ProtectedSetterName = new PrefixNameKind(PROTECTEDSETTER, "protected$set") // dubious encoding, kept for Scala2 compatibility
352352
val AvoidClashName = new SuffixNameKind(AVOIDCLASH, "$_avoid_name_clash_$")
353353
val DirectMethodName = new SuffixNameKind(DIRECT, "$direct") { override def definesNewName = true }
354-
val FieldName = new SuffixNameKind(FIELD, "$$local")
354+
val FieldName = new SuffixNameKind(FIELD, "$$local") {
355+
override def mkString(underlying: TermName, info: ThisInfo) = underlying.toString
356+
}
355357
val ExtMethName = new SuffixNameKind(EXTMETH, "$extension")
356358
val ModuleVarName = new SuffixNameKind(OBJECTVAR, "$module")
357359
val ModuleClassName = new SuffixNameKind(OBJECTCLASS, "$", optInfoString = "ModuleClass")

tests/run/paramForwarding.check

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
B:
2-
private final int B.theValue$$local
3-
private final int B.theValueInB$$local
2+
private final int B.theValue
3+
private final int B.theValueInB
44
Bz:
5-
private final int Bz.theValue$$local
6-
private final int Bz.theValueInBz$$local
5+
private final int Bz.theValue
6+
private final int Bz.theValueInBz
77
C:
88

99
D:
10-
private final int D.other$$local
10+
private final int D.other
1111
NonVal:
1212

1313
X:
14-
private final int X.theValue$$local
14+
private final int X.theValue
1515
Y:
1616

tests/run/paramForwarding_separate.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Fields in A:
2-
private final int A.member$$local
2+
private final int A.member
33
# Fields in SubA:
44

55
# Fields in B:

tests/run/paramForwarding_together.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Fields in A:
2-
private final int A.member$$local
2+
private final int A.member
33
# Fields in SubA:
44

55
# Fields in B:

tests/run/paramForwarding_together_b.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Fields in A:
2-
private final int A.member$$local
2+
private final int A.member
33
# Fields in SubA:
44

55
# Fields in B:

tests/run/statics.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import scala.annotation.static
22

33
class Foo{
44
class Bar {
5-
def qwa =
5+
def qwa =
66
Bar.field
77
// 0: invokestatic #31 // Method Foo$Bar$.field:()I
88
// 3: ireturn
99
}
1010
object Bar {
11-
@static
11+
@static
1212
val field = 1
1313
}
1414
}
1515

16-
object Foo{
16+
object Foo{
1717
@static
1818
def method = 1
1919

@@ -35,6 +35,6 @@ object Test {
3535
}
3636

3737
class WithLazies{
38-
@volatile lazy val s = 1
38+
@volatile lazy val s = 1
3939
// 98: getstatic #30 // Field WithLazies$.OFFSET$0:J
4040
}

tests/run/variable-pattern-access.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Fields of A:
2-
private final int A.a$$local
3-
private final int A.b$$local
2+
private final int A.a
3+
private final int A.b
44
private final scala.Tuple2 A.$1$
55
# Methods of A:
66
public int A.a()

0 commit comments

Comments
 (0)