aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala2
-rw-r--r--src/dotty/tools/dotc/transform/TraitConstructors.scala3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 5e37324a0..c6264b817 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -315,7 +315,7 @@ object SymDenotations {
encl = encl.owner
sep += "~"
}
- if (owner.is(ModuleClass) && sep == "$") sep = "" // duplicate scalac's behavior: don't write a double '$$' for module class members.
+ if (owner.is(ModuleClass, butNot = Package) && sep == "$") sep = "" // duplicate scalac's behavior: don't write a double '$$' for module class members.
val fn = encl.fullNameSeparated(separator) ++ sep ++ name
if (isType) fn.toTypeName else fn.toTermName
}
diff --git a/src/dotty/tools/dotc/transform/TraitConstructors.scala b/src/dotty/tools/dotc/transform/TraitConstructors.scala
index a98f52ca4..99ae3e187 100644
--- a/src/dotty/tools/dotc/transform/TraitConstructors.scala
+++ b/src/dotty/tools/dotc/transform/TraitConstructors.scala
@@ -23,7 +23,8 @@ class TraitConstructors extends MiniPhaseTransform with SymTransformer {
def transformSym(sym: SymDenotation)(implicit ctx: Context): SymDenotation = {
if (sym.isPrimaryConstructor && (sym.owner is Flags.Trait))
- sym.copySymDenotation(name = nme.INITIALIZER_PREFIX ++ sym.owner.fullName)
+ // TODO: Someone needs to carefully check if name clashes are possible with this mangling scheme
+ sym.copySymDenotation(name = nme.INITIALIZER_PREFIX ++ sym.owner.fullNameSeparated("$"))
else sym
}