diff options
author | Dmitry Petrashko <dark@d-d.me> | 2015-05-21 11:01:55 +0200 |
---|---|---|
committer | Dmitry Petrashko <dark@d-d.me> | 2015-05-21 11:01:55 +0200 |
commit | bf81fb62084f9e04e43906396c3ac5e307caca63 (patch) | |
tree | 8584f70eacba7c20c2eee40380287f5de9b6fdd1 /src | |
parent | ca07c71c2040ec836808fcc8a985c8a9ba9fa677 (diff) | |
parent | 8f885892f80c988beb8206358214291ec445696f (diff) | |
download | dotty-bf81fb62084f9e04e43906396c3ac5e307caca63.tar.gz dotty-bf81fb62084f9e04e43906396c3ac5e307caca63.tar.bz2 dotty-bf81fb62084f9e04e43906396c3ac5e307caca63.zip |
Merge pull request #589 from smarter/fix/trait-init-name
TraitConstructors: Use a valid method name for the initializer (fix #577)
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/TraitConstructors.scala | 3 |
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 } |