aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform
diff options
context:
space:
mode:
authorliu fengyun <liu@fengy.me>2017-03-18 11:57:08 +0100
committerGitHub <noreply@github.com>2017-03-18 11:57:08 +0100
commit8b2d315936149efb15ded478fcc1d95ac9650e56 (patch)
treec6224496eccb39860f9b5d08fceb9055b6e15cbc /compiler/src/dotty/tools/dotc/transform
parentd0621108bad55f9fc66c1c5ade9a0b7edb3117e7 (diff)
parentd45c09acb49c862f38d1de588abac3412876e32e (diff)
downloaddotty-8b2d315936149efb15ded478fcc1d95ac9650e56.tar.gz
dotty-8b2d315936149efb15ded478fcc1d95ac9650e56.tar.bz2
dotty-8b2d315936149efb15ded478fcc1d95ac9650e56.zip
Merge pull request #2058 from dotty-staging/fix-2054
Fix #2054
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala8
-rw-r--r--compiler/src/dotty/tools/dotc/transform/MoveStatics.scala2
2 files changed, 8 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala b/compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala
index 83cd395ff..8f99ef1d0 100644
--- a/compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala
+++ b/compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala
@@ -3,7 +3,7 @@ package transform
import core._
import dotty.tools.dotc.ast.tpd
-import dotty.tools.dotc.core.DenotTransformers.{SymTransformer, IdentityDenotTransformer}
+import dotty.tools.dotc.core.DenotTransformers.{IdentityDenotTransformer, SymTransformer}
import Contexts.Context
import Symbols._
import Scopes._
@@ -11,13 +11,16 @@ import Flags._
import StdNames._
import SymDenotations._
import Types._
+
import collection.mutable
import TreeTransforms._
import Decorators._
import ast.Trees._
import TreeTransforms._
import java.io.File.separatorChar
+
import ValueClasses._
+import dotty.tools.dotc.core.Phases.Phase
/** Make private term members that are accessed from another class
* non-private by resetting the Private flag and expanding their name.
@@ -38,6 +41,9 @@ class ExpandPrivate extends MiniPhaseTransform with IdentityDenotTransformer { t
override def phaseName: String = "expandPrivate"
+ // This phase moves methods around (in infotransform) so it may need to make other methods public
+ override def runsAfter: Set[Class[_ <: Phase]] = Set(classOf[MoveStatics])
+
override def checkPostCondition(tree: Tree)(implicit ctx: Context): Unit = {
tree match {
case t: DefDef =>
diff --git a/compiler/src/dotty/tools/dotc/transform/MoveStatics.scala b/compiler/src/dotty/tools/dotc/transform/MoveStatics.scala
index 5c2cd3145..b0ee0930d 100644
--- a/compiler/src/dotty/tools/dotc/transform/MoveStatics.scala
+++ b/compiler/src/dotty/tools/dotc/transform/MoveStatics.scala
@@ -9,6 +9,7 @@ import dotty.tools.dotc.core.Decorators._
import dotty.tools.dotc.core.NameOps._
import dotty.tools.dotc.core.{Flags, Names}
import dotty.tools.dotc.core.Names.Name
+import dotty.tools.dotc.core.Phases.Phase
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Types.MethodType
import dotty.tools.dotc.transform.TreeTransforms.{MiniPhaseTransform, TransformerInfo}
@@ -19,7 +20,6 @@ class MoveStatics extends MiniPhaseTransform with SymTransformer { thisTransform
import tpd._
override def phaseName = "moveStatic"
-
def transformSym(sym: SymDenotation)(implicit ctx: Context): SymDenotation = {
if (sym.hasAnnotation(defn.ScalaStaticAnnot) && sym.owner.is(Flags.Module) && sym.owner.companionClass.exists) {
sym.owner.asClass.delete(sym.symbol)