Skip to content

Commit

Permalink
Fix scala#14667: Remove mangling of inner AnyQualifiedName's in fullN…
Browse files Browse the repository at this point in the history
…ameSeparated.

This brings the `case name @ AnyQualfiedName(_, _)` in line with
the behavior of `case naem: SimpleName`, which already did not
mangle before this change.

This fixes scala#14667 because `Mixin.traitSetterName` indirectly calls
`fullNameSeparated`, and expanded private symbolic member names
would get mangled, and therefore could not identify their
corresponding fields anymore.
  • Loading branch information
gagandeepkalra authored and sjrd committed Jul 19, 2022
1 parent 67f11ff commit 1b4e0e2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ object SymDenotations {
if kind == FlatName && !encl.is(JavaDefined) then qn.compactified else qn
val fn = name replace {
case name: SimpleName => qualify(name)
case name @ AnyQualifiedName(_, _) => qualify(name.mangled.toSimpleName)
case name @ AnyQualifiedName(_, _) => qualify(name.toSimpleName)
}
if (name.isTypeName) fn.toTypeName else fn.toTermName
}
Expand Down
2 changes: 2 additions & 0 deletions tests/run/i14667.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sigma
alpha beta gamma
16 changes: 16 additions & 0 deletions tests/run/i14667.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
trait A {
private val ? = "sigma"
def a = ?

val ?? = "alpha beta gamma"
def b = ??
}

class B extends A

object Test {
def main(args: Array[String]): Unit = {
println(new B().a)
println(new B().b)
}
}

0 comments on commit 1b4e0e2

Please sign in to comment.