diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-26 15:42:44 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-26 16:20:33 +0100 |
commit | 7baead9f9644bffe51a5c6e884cd6c516205fbe2 (patch) | |
tree | 596bce20dc201f1d8c52410cf7b8385a0016ee99 /src/dotty/tools/dotc/ast/Desugar.scala | |
parent | 25af81475b3e4f387caa67194409e9b595a3b2ea (diff) | |
download | dotty-7baead9f9644bffe51a5c6e884cd6c516205fbe2.tar.gz dotty-7baead9f9644bffe51a5c6e884cd6c516205fbe2.tar.bz2 dotty-7baead9f9644bffe51a5c6e884cd6c516205fbe2.zip |
Add companion link symbols early only if companion actually exists
Otherwise we'll trigger early creation of companions that could shadow something.
Diffstat (limited to 'src/dotty/tools/dotc/ast/Desugar.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index cc94e9b27..961675fed 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -330,13 +330,6 @@ object desugar { .withMods(synthetic)) .withPos(cdef.pos).toList - def companionClassGeterMethod = - DefDef(nme.COMPANION_CLASS_METHOD, Nil, Nil, Ident(name), - /*Select(Select( - Select(Ident(nme.ROOTPKG), nme.scala_), - nme.Predef), nme.???)*/ Ident(nme.???)) - .withMods(synthetic | Private) - // The companion object defifinitions, if a companion is needed, Nil otherwise. // companion definitions include: // 1. If class is a case class case class C[Ts](p1: T1, ..., pN: TN)(moreParams): @@ -366,13 +359,11 @@ object desugar { DefDef(nme.unapply, derivedTparams, (unapplyParam :: Nil) :: Nil, TypeTree(), unapplyRHS) .withMods(synthetic) } - companionDefs(parent, companionClassGeterMethod :: applyMeths ::: unapplyMeth :: defaultGetters) + companionDefs(parent, applyMeths ::: unapplyMeth :: defaultGetters) } else { - val methods = if (!(mods is Synthetic | Module)) companionClassGeterMethod :: defaultGetters else defaultGetters - - if(methods.nonEmpty) - companionDefs(anyRef, methods) + if (defaultGetters.nonEmpty) + companionDefs(anyRef, defaultGetters) else Nil } |