aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-04-23 21:06:42 +0200
committerMartin Odersky <odersky@gmail.com>2015-04-23 21:06:42 +0200
commit2b3591cec6a1d58f3346b6c8933ca0742f13c1cf (patch)
treef334787708775f72a8f4bdf10e384a89460414a8 /src/dotty/tools
parent36c229ba8c3d44546b34446ca36c8f335a9c5f47 (diff)
downloaddotty-2b3591cec6a1d58f3346b6c8933ca0742f13c1cf.tar.gz
dotty-2b3591cec6a1d58f3346b6c8933ca0742f13c1cf.tar.bz2
dotty-2b3591cec6a1d58f3346b6c8933ca0742f13c1cf.zip
Remove trailing whitespace
I have figured out how to make this the default in Eclipse, so hopefully we won't see many repeats of this.
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala4
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala2
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala2
-rw-r--r--src/dotty/tools/dotc/core/Types.scala8
-rw-r--r--src/dotty/tools/dotc/core/pickling/TreeUnpickler.scala2
-rw-r--r--src/dotty/tools/dotc/transform/ExtensionMethods.scala2
-rw-r--r--src/dotty/tools/dotc/transform/LambdaLift.scala22
-rw-r--r--src/dotty/tools/dotc/transform/ParamForwarding.scala4
-rw-r--r--src/dotty/tools/dotc/transform/PostTyper.scala42
-rw-r--r--src/dotty/tools/dotc/transform/SuperAccessors.scala28
-rw-r--r--src/dotty/tools/dotc/transform/SyntheticMethods.scala6
-rw-r--r--src/dotty/tools/dotc/transform/TypeUtils.scala2
12 files changed, 62 insertions, 62 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 0b5e10220..83499ca7b 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -210,9 +210,9 @@ object SymDenotations {
/** Does this denotation have an annotation matching the given class symbol? */
final def hasAnnotation(cls: Symbol)(implicit ctx: Context) =
dropOtherAnnotations(annotations, cls).nonEmpty
-
+
/** Apply transform `f` to all annotations of this denotation */
- final def transformAnnotations(f: Annotation => Annotation)(implicit ctx: Context): Unit =
+ final def transformAnnotations(f: Annotation => Annotation)(implicit ctx: Context): Unit =
annotations = annotations.mapConserve(f)
/** Optionally, the annotation matching the given class symbol */
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala
index bce0a5450..36167ae7f 100644
--- a/src/dotty/tools/dotc/core/Symbols.scala
+++ b/src/dotty/tools/dotc/core/Symbols.scala
@@ -560,7 +560,7 @@ object Symbols {
/** The Definitions object */
def defn(implicit ctx: Context): Definitions = ctx.definitions
-
+
/** The current class */
def currentClass(implicit ctx: Context): ClassSymbol = ctx.owner.enclosingClass.asClass
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index de42b3e5f..5325189e1 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -279,7 +279,7 @@ class TypeApplications(val self: Type) extends AnyVal {
default
}
}
-
+
/** Translate a type of the form From[T] to To[T], keep other types as they are.
* `from` and `to` must be static classes, both with one type parameter, and the same variance.
*/
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index fe95219b8..e290e8868 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1788,12 +1788,12 @@ object Types {
if (false) RefinedType(parent, refinedName, refinedInfo)
else RefinedType(parent, refinedName, rt => refinedInfo.substSkolem(this, SkolemType(rt)))
}
-
+
/** Add this refinement to `parent`, provided If `refinedName` is a member of `parent`. */
def wrapIfMember(parent: Type)(implicit ctx: Context): Type =
if (parent.member(refinedName).exists) derivedRefinedType(parent, refinedName, refinedInfo)
else parent
-
+
override def equals(that: Any) = that match {
case that: RefinedType =>
this.parent == that.parent &&
@@ -2414,7 +2414,7 @@ object Types {
selfTypeCache = {
def fullRef = fullyAppliedRef(cls.typeRef, cls.typeParams)
val given = givenSelfType
- val raw =
+ val raw =
if (!given.exists) fullRef
else if (cls is Module) given
else if (ctx.erasedTypes) fullRef
@@ -2423,7 +2423,7 @@ object Types {
}
selfTypeCache
}
-
+
/** The explicitly given self type (self types of modules are assumed to be
* explcitly given here).
*/
diff --git a/src/dotty/tools/dotc/core/pickling/TreeUnpickler.scala b/src/dotty/tools/dotc/core/pickling/TreeUnpickler.scala
index 59bd017fa..ba3023ed1 100644
--- a/src/dotty/tools/dotc/core/pickling/TreeUnpickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/TreeUnpickler.scala
@@ -669,7 +669,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
case _ =>
readTerm()(ctx.withOwner(exprOwner))
}
-
+
def readImport()(implicit ctx: Context): Tree = {
readByte()
readEnd()
diff --git a/src/dotty/tools/dotc/transform/ExtensionMethods.scala b/src/dotty/tools/dotc/transform/ExtensionMethods.scala
index df769a80f..ae22adc39 100644
--- a/src/dotty/tools/dotc/transform/ExtensionMethods.scala
+++ b/src/dotty/tools/dotc/transform/ExtensionMethods.scala
@@ -30,7 +30,7 @@ class ExtensionMethods extends MiniPhaseTransform with DenotTransformer with Ful
override def phaseName: String = "extmethods"
override def runsAfter: Set[Class[_ <: Phase]] = Set(classOf[ElimRepeated])
-
+
override def runsAfterGroupsOf = Set(classOf[FirstTransform]) // need companion objects to exist
override def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = ref match {
diff --git a/src/dotty/tools/dotc/transform/LambdaLift.scala b/src/dotty/tools/dotc/transform/LambdaLift.scala
index 9b35d1d99..1a23d887c 100644
--- a/src/dotty/tools/dotc/transform/LambdaLift.scala
+++ b/src/dotty/tools/dotc/transform/LambdaLift.scala
@@ -107,18 +107,18 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform
* in `enclosure` or there is an intermediate class properly containing `enclosure`
* in which `sym` is also free. Also, update `liftedOwner` of `enclosure` so
* that `enclosure` can access `sym`, or its proxy in an intermediate class.
- * This means:
- *
+ * This means:
+ *
* 1. If there is an intermediate class in which `sym` is free, `enclosure`
- * must be contained in that class (in order to access the `sym proxy stored
+ * must be contained in that class (in order to access the `sym proxy stored
* in the class).
- *
+ *
* 2. If there is no intermediate class, `enclosure` must be contained
* in the class enclosing `sym`.
- *
+ *
* Return the closest enclosing intermediate class between `enclosure` and
* the owner of sym, or NoSymbol if none exists.
- *
+ *
* pre: sym.owner.isTerm, (enclosure.isMethod || enclosure.isClass)
*
* The idea of `markFree` is illustrated with an example:
@@ -150,10 +150,10 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform
else {
ctx.log(i"mark free: ${sym.showLocated} with owner ${sym.maybeOwner} marked free in $enclosure")
ctx.debuglog(i"$enclosure != ${sym.enclosure}")
- val intermediate =
+ val intermediate =
if (enclosure.is(PackageClass)) enclosure
- else markFree(sym, enclosure.skipConstructor.enclosure)
- // `enclosure` might be a constructor, in which case we want the enclosure
+ else markFree(sym, enclosure.skipConstructor.enclosure)
+ // `enclosure` might be a constructor, in which case we want the enclosure
// of the enclosing class, so skipConstructor is needed here.
if (intermediate.exists) {
narrowLiftedOwner(enclosure, intermediate)
@@ -394,12 +394,12 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform
val sym = tree.symbol
tree.tpe match {
case tpe @ TermRef(prefix, _) =>
- if (prefix eq NoPrefix)
+ if (prefix eq NoPrefix)
if (sym.enclosure != currentEnclosure && !sym.isStatic)
(if (sym is Method) memberRef(sym) else proxyRef(sym)).withPos(tree.pos)
else if (sym.owner.isClass) // sym was lifted out
ref(sym).withPos(tree.pos)
- else
+ else
tree
else if (!prefixIsElidable(tpe)) ref(tpe)
else tree
diff --git a/src/dotty/tools/dotc/transform/ParamForwarding.scala b/src/dotty/tools/dotc/transform/ParamForwarding.scala
index 883a33ff2..87ecaba07 100644
--- a/src/dotty/tools/dotc/transform/ParamForwarding.scala
+++ b/src/dotty/tools/dotc/transform/ParamForwarding.scala
@@ -21,7 +21,7 @@ import Contexts._, Types._, Symbols._, Flags._, TypeUtils._, DenotTransformers._
*/
class ParamForwarding(thisTransformer: DenotTransformer) {
import ast.tpd._
-
+
def forwardParamAccessors(impl: Template)(implicit ctx: Context): Template = {
def fwd(stats: List[Tree])(implicit ctx: Context): List[Tree] = {
val (superArgs, superParamNames) = impl.parents match {
@@ -68,4 +68,4 @@ class ParamForwarding(thisTransformer: DenotTransformer) {
cpy.Template(impl)(body = fwd(impl.body)(ctx.withPhase(thisTransformer)))
}
-} \ No newline at end of file
+}
diff --git a/src/dotty/tools/dotc/transform/PostTyper.scala b/src/dotty/tools/dotc/transform/PostTyper.scala
index c6031b31e..55270f233 100644
--- a/src/dotty/tools/dotc/transform/PostTyper.scala
+++ b/src/dotty/tools/dotc/transform/PostTyper.scala
@@ -16,26 +16,26 @@ import Decorators._
import Symbols._, TypeUtils._
/** A macro transform that runs immediately after typer and that performs the following functions:
- *
+ *
* (1) Add super accessors and protected accessors (@see SuperAccessors)
- *
+ *
* (2) Convert parameter fields that have the same name as a corresponding
* public parameter field in a superclass to a forwarder to the superclass
* field (corresponding = super class field is initialized with subclass field)
* (@see ForwardParamAccessors)
- *
+ *
* (3) Add synthetic methods (@see SyntheticMethods)
- *
+ *
* (4) Check that `New` nodes can be instantiated, and that annotations are valid
- *
+ *
* (5) Convert all trees representing types to TypeTrees.
- *
+ *
* (6) Check the bounds of AppliedTypeTrees
- *
+ *
* (7) Insert `.package` for selections of package object members
- *
+ *
* (8) Replaces self references by name with `this`
- *
+ *
* The reason for making this a macro transform is that some functions (in particular
* super and protected accessors and instantiation checks) are naturally top-down and
* don't lend themselves to the bottom-up approach of a mini phase. The other two functions
@@ -54,16 +54,16 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran
protected def newTransformer(implicit ctx: Context): Transformer =
new PostTyperTransformer
-
+
val superAcc = new SuperAccessors(thisTransformer)
val paramFwd = new ParamForwarding(thisTransformer)
val synthMth = new SyntheticMethods(thisTransformer)
-
+
private def newPart(tree: Tree): Option[New] = methPart(tree) match {
case Select(nu: New, _) => Some(nu)
case _ => None
}
-
+
private def checkValidJavaAnnotation(annot: Tree)(implicit ctx: Context): Unit = {
// TODO fill in
}
@@ -79,17 +79,17 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran
tparam.info.asSeenFrom(tycon.tpe.normalizedPrefix, tparam.owner.owner).bounds)
Checking.checkBounds(args, bounds, _.substDealias(tparams, _))
norm(tree)
- case _ =>
+ case _ =>
norm(tree)
- }
+ }
}
class PostTyperTransformer extends Transformer {
-
+
private var inJavaAnnot: Boolean = false
-
+
private var parentNews: Set[New] = Set()
-
+
private def transformAnnot(annot: Tree)(implicit ctx: Context): Tree = {
val saved = inJavaAnnot
inJavaAnnot = annot.symbol is JavaDefined
@@ -97,10 +97,10 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran
try transform(annot)
finally inJavaAnnot = saved
}
-
+
private def transformAnnot(annot: Annotation)(implicit ctx: Context): Annotation =
annot.derivedAnnotation(transformAnnot(annot.tree))
-
+
private def transformAnnots(tree: MemberDef)(implicit ctx: Context): Unit =
tree.symbol.transformAnnotations(transformAnnot)
@@ -114,7 +114,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran
superAcc.transformSelect(super.transform(tree), targs)
}
}
-
+
override def transform(tree: Tree)(implicit ctx: Context): Tree =
try normalizeTypeTree(tree) match {
case tree: Ident =>
@@ -133,7 +133,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran
case tree: Template =>
val saved = parentNews
parentNews ++= tree.parents.flatMap(newPart)
- try
+ try
synthMth.addSyntheticMethods(
paramFwd.forwardParamAccessors(
superAcc.wrapTemplate(tree)(
diff --git a/src/dotty/tools/dotc/transform/SuperAccessors.scala b/src/dotty/tools/dotc/transform/SuperAccessors.scala
index a0069878d..b111fdb92 100644
--- a/src/dotty/tools/dotc/transform/SuperAccessors.scala
+++ b/src/dotty/tools/dotc/transform/SuperAccessors.scala
@@ -43,11 +43,11 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
* These are value class methods, which will become extension methods.
* (By-name arguments used to be included also, but these
* don't get a new class anymore, they are just wrapped in a new method).
- *
+ *
* These regions will have to be treated specially for the purpose
* of adding accessors. For instance, super calls from these regions
* always have to go through an accessor.
- *
+ *
* The `invalidOwner` field, if different from NoSymbol,
* contains the symbol that is not a valid owner.
*/
@@ -59,10 +59,10 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
try trans
finally invalidEnclClass = saved
}
-
- private def validCurrentClass(implicit ctx: Context): Boolean =
+
+ private def validCurrentClass(implicit ctx: Context): Boolean =
ctx.owner.enclosingClass != invalidEnclClass
-
+
/** List buffers for new accessor definitions, indexed by class */
private val accDefs = mutable.Map[Symbol, mutable.ListBuffer[Tree]]()
@@ -140,7 +140,7 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
(sym eq Any_##)
}
- /** Replace `sel` (or `sel[targs]` if `targs` is nonempty) with a protected accessor
+ /** Replace `sel` (or `sel[targs]` if `targs` is nonempty) with a protected accessor
* call, if necessary.
*/
private def ensureProtectedAccessOK(sel: Select, targs: List[Tree])(implicit ctx: Context) = {
@@ -204,12 +204,12 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
ctx.debuglog(s"Replaced $sel with $res")
res
}
-
+
def isProtectedAccessor(tree: Tree)(implicit ctx: Context): Boolean = tree match {
case Apply(TypeApply(Select(_, name), _), qual :: Nil) => name.isProtectedAccessorName
case _ => false
}
-
+
/** Add a protected accessor, if needed, and return a tree that calls
* the accessor and returns the same member. The result is already
* typed.
@@ -225,8 +225,8 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
// if the result type depends on the this type of an enclosing class, the accessor
// has to take an object of exactly this type, otherwise it's more general
- val receiverType =
- if (isThisType(sym.info.finalResultType)) clazz.thisType
+ val receiverType =
+ if (isThisType(sym.info.finalResultType)) clazz.thisType
else clazz.classInfo.selfType
def accTypeOf(tpe: Type): Type = tpe match {
case tpe: PolyType =>
@@ -401,10 +401,10 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
val setter = protectedSetter(lhs)
ctx.debuglog("Replaced " + tree + " with " + setter)
setter.appliedTo(qual, rhs)
- }
- else tree
+ }
+ else tree
}
-
+
/** Wrap template to template transform `op` with needed initialization and finalization */
def wrapTemplate(tree: Template)(op: Template => Template)(implicit ctx: Context) = {
accDefs(currentClass) = new mutable.ListBuffer[Tree]
@@ -417,7 +417,7 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
case vd: ValOrDefDef => vd.symbol.flags is ParamAccessor
case _ => false
}
- cpy.Template(impl)(body = params ++ accessors ++ rest)
+ cpy.Template(impl)(body = params ++ accessors ++ rest)
}
}
diff --git a/src/dotty/tools/dotc/transform/SyntheticMethods.scala b/src/dotty/tools/dotc/transform/SyntheticMethods.scala
index 222b64575..9d0aebe45 100644
--- a/src/dotty/tools/dotc/transform/SyntheticMethods.scala
+++ b/src/dotty/tools/dotc/transform/SyntheticMethods.scala
@@ -31,18 +31,18 @@ import scala.language.postfixOps
* def equals(other: Any): Boolean
* def hashCode(): Int
*/
-class SyntheticMethods(thisTransformer: DenotTransformer) {
+class SyntheticMethods(thisTransformer: DenotTransformer) {
import ast.tpd._
private var myValueSymbols: List[Symbol] = Nil
private var myCaseSymbols: List[Symbol] = Nil
-
+
private def initSymbols(implicit ctx: Context) =
if (myValueSymbols.isEmpty) {
myValueSymbols = List(defn.Any_hashCode, defn.Any_equals)
myCaseSymbols = myValueSymbols ++ List(defn.Any_toString, defn.Product_canEqual, defn.Product_productArity)
}
-
+
def valueSymbols(implicit ctx: Context) = { initSymbols; myValueSymbols }
def caseSymbols(implicit ctx: Context) = { initSymbols; myCaseSymbols }
diff --git a/src/dotty/tools/dotc/transform/TypeUtils.scala b/src/dotty/tools/dotc/transform/TypeUtils.scala
index 5ef1e5ed3..c01b6478c 100644
--- a/src/dotty/tools/dotc/transform/TypeUtils.scala
+++ b/src/dotty/tools/dotc/transform/TypeUtils.scala
@@ -26,7 +26,7 @@ class TypeUtils(val self: Type) extends AnyVal {
def isPrimitiveValueType(implicit ctx: Context): Boolean =
self.classSymbol.isPrimitiveValueClass
-
+
def ensureMethodic(implicit ctx: Context): Type = self match {
case self: MethodicType => self
case _ => ExprType(self)