From afa630a78b4f2cd9bd799b5a0199b99548f18aaa Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Thu, 9 Apr 2015 16:57:55 +0200 Subject: Remove trailing spaces in Dotty source. --- src/dotty/tools/dotc/typer/EtaExpansion.scala | 2 +- src/dotty/tools/dotc/typer/Implicits.scala | 2 +- src/dotty/tools/dotc/typer/Inferencing.scala | 4 ++-- src/dotty/tools/dotc/typer/Mode.scala | 6 +++--- src/dotty/tools/dotc/typer/Namer.scala | 24 ++++++++++++------------ src/dotty/tools/dotc/typer/ProtoTypes.scala | 6 +++--- src/dotty/tools/dotc/typer/TypeAssigner.scala | 4 ++-- src/dotty/tools/dotc/typer/Typer.scala | 10 +++++----- 8 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src/dotty/tools/dotc/typer') diff --git a/src/dotty/tools/dotc/typer/EtaExpansion.scala b/src/dotty/tools/dotc/typer/EtaExpansion.scala index b59748247..1c0e6a11f 100644 --- a/src/dotty/tools/dotc/typer/EtaExpansion.scala +++ b/src/dotty/tools/dotc/typer/EtaExpansion.scala @@ -37,7 +37,7 @@ object EtaExpansion { case Apply(MaybePoly(fn @ Select(pre, name), targs), args) => cpy.Apply(tree)( cpy.Select(fn)( - lift(defs, pre), name).appliedToTypeTrees(targs), + lift(defs, pre), name).appliedToTypeTrees(targs), liftArgs(defs, fn.tpe, args)) case Select(pre, name) => cpy.Select(tree)(lift(defs, pre), name) diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index 1f5fd3899..2c7aaaeb1 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -455,7 +455,7 @@ trait Implicits { self: Typer => private def nestedContext = ctx.fresh.setMode(ctx.mode &~ Mode.ImplicitsEnabled) private def implicitProto(resultType: Type, f: Type => Type) = - if (argument.isEmpty) f(resultType) else ViewProto(f(argument.tpe.widen), f(resultType)) + if (argument.isEmpty) f(resultType) else ViewProto(f(argument.tpe.widen), f(resultType)) // Not clear whether we need to drop the `.widen` here. All tests pass with it in place, though. assert(argument.isEmpty || argument.tpe.isValueType || argument.tpe.isInstanceOf[ExprType], diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 424575f8c..0223260a0 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -163,7 +163,7 @@ trait Inferencing { this: Checking => * If such a variable appears covariantly in type `tp` or does not appear at all, * approximate it by its lower bound. Otherwise, if it appears contravariantly * in type `tp` approximate it by its upper bound. - * @param ownedBy if it is different from NoSymbol, all type variables owned by + * @param ownedBy if it is different from NoSymbol, all type variables owned by * `ownedBy` qualify, independent of position. * Without that second condition, it can be that certain variables escape * interpolation, for instance when their tree was eta-lifted, so @@ -173,7 +173,7 @@ trait Inferencing { this: Checking => */ def interpolateUndetVars(tree: Tree, ownedBy: Symbol)(implicit ctx: Context): Unit = { val constraint = ctx.typerState.constraint - val qualifies = (tvar: TypeVar) => + val qualifies = (tvar: TypeVar) => (tree contains tvar.owningTree) || ownedBy.exists && tvar.owner == ownedBy def interpolate() = Stats.track("interpolateUndetVars") { val tp = tree.tpe.widen diff --git a/src/dotty/tools/dotc/typer/Mode.scala b/src/dotty/tools/dotc/typer/Mode.scala index 95c15f8ab..997741819 100644 --- a/src/dotty/tools/dotc/typer/Mode.scala +++ b/src/dotty/tools/dotc/typer/Mode.scala @@ -31,8 +31,8 @@ object Mode { val ImplicitsEnabled = newMode(2, "ImplicitsEnabled") val InferringReturnType = newMode(3, "InferringReturnType") - /** This mode bit is set if we collect information without reference to a valid - * context with typerstate and constraint. This is typically done when we + /** This mode bit is set if we collect information without reference to a valid + * context with typerstate and constraint. This is typically done when we * cache the eligibility of implicits. Caching needs to be done across different constraints. * Therefore, if TypevarsMissContext is set, subtyping becomes looser, and assumes * that PolyParams can be sub- and supertypes of anything. See TypeComparer. @@ -56,7 +56,7 @@ object Mode { /** Allow GADTFlexType labelled types to have their bounds adjusted */ val GADTflexible = newMode(8, "GADTflexible") - + /** Allow dependent functions. This is currently necessary for unpickling, because * some dependent functions are passed through from the front end(s?), even though they * are technically speaking illegal. diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 01c1c28ab..10667f884 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -18,7 +18,7 @@ import config.Printers._ import language.implicitConversions trait NamerContextOps { this: Context => - + /** Enter symbol into current class, if current class is owner of current context, * or into current scope, if not. Should always be called instead of scope.enter * in order to make sure that updates to class members are reflected in @@ -83,7 +83,7 @@ trait NamerContextOps { this: Context => /** The given type, unless `sym` is a constructor, in which case the * type of the constructed instance is returned */ - def effectiveResultType(sym: Symbol, typeParams: List[Symbol], given: Type) = + def effectiveResultType(sym: Symbol, typeParams: List[Symbol], given: Type) = if (sym.name == nme.CONSTRUCTOR) sym.owner.typeRef.appliedTo(typeParams map (_.typeRef)) else given @@ -112,19 +112,19 @@ trait NamerContextOps { this: Context => else if (valueParamss.isEmpty) ExprType(monotpe) else monotpe } - + /** Find moduleClass/sourceModule in effective scope */ private def findModuleBuddy(name: Name)(implicit ctx: Context) = { val scope = effectiveScope val it = scope.lookupAll(name).filter(_ is Module) assert(it.hasNext, s"no companion $name in $scope") it.next - } + } /** Add moduleClass or sourceModule functionality to completer * for a module or module class */ - def adjustModuleCompleter(completer: LazyType, name: Name) = + def adjustModuleCompleter(completer: LazyType, name: Name) = if (name.isTermName) completer withModuleClass (_ => findModuleBuddy(name.moduleClassName)) else @@ -233,9 +233,9 @@ class Namer { typer: Typer => /** Add moduleClass/sourceModule to completer if it is for a module val or class */ def adjustIfModule(completer: LazyType, tree: MemberDef) = - if (tree.mods is Module) ctx.adjustModuleCompleter(completer, tree.name.encode) + if (tree.mods is Module) ctx.adjustModuleCompleter(completer, tree.name.encode) else completer - + typr.println(i"creating symbol for $tree in ${ctx.mode}") def checkNoConflict(name: Name): Unit = { @@ -689,11 +689,11 @@ class Namer { typer: Typer => lhsType orElse WildcardType } } - + val tptProto = mdef.tpt match { - case _: untpd.DerivedTypeTree => + case _: untpd.DerivedTypeTree => WildcardType - case TypeTree(untpd.EmptyTree) => + case TypeTree(untpd.EmptyTree) => inferredType case TypedSplice(tpt: TypeTree) if !isFullyDefined(tpt.tpe, ForceDegree.none) => val rhsType = typedAheadExpr(mdef.rhs, tpt.tpe).tpe @@ -708,7 +708,7 @@ class Namer { typer: Typer => case _ => } WildcardType - case _ => + case _ => WildcardType } paramFn(typedAheadType(mdef.tpt, tptProto).tpe) @@ -742,7 +742,7 @@ class Namer { typer: Typer => val isDerived = tdef.rhs.isInstanceOf[untpd.DerivedTypeTree] val toParameterize = tparamSyms.nonEmpty && !isDerived val needsLambda = sym.allOverriddenSymbols.exists(_ is HigherKinded) && !isDerived - def abstracted(tp: Type): Type = + def abstracted(tp: Type): Type = if (needsLambda) tp.LambdaAbstract(tparamSyms) else if (toParameterize) tp.parameterizeWith(tparamSyms) else tp diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala index ac58615aa..eb5758662 100644 --- a/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -165,7 +165,7 @@ object ProtoTypes { case class FunProto(args: List[untpd.Tree], resType: Type, typer: Typer)(implicit ctx: Context) extends UncachedGroundType with ApplyingProto { private var myTypedArgs: List[Tree] = Nil - + override def resultType(implicit ctx: Context) = resType /** A map in which typed arguments can be stored to be later integrated in `typedArgs`. */ @@ -247,7 +247,7 @@ object ProtoTypes { extends CachedGroundType with ApplyingProto { override def resultType(implicit ctx: Context) = resType - + def isMatchedBy(tp: Type)(implicit ctx: Context): Boolean = ctx.typer.isApplicable(tp, argType :: Nil, resultType) @@ -383,7 +383,7 @@ object ProtoTypes { tp.derivedRefinedType(wildApprox(tp.parent, theMap), tp.refinedName, wildApprox(tp.refinedInfo, theMap)) case tp: TypeAlias => // default case, inlined for speed tp.derivedTypeAlias(wildApprox(tp.alias, theMap)) - case tp @ PolyParam(poly, pnum) => + case tp @ PolyParam(poly, pnum) => ctx.typerState.constraint.entry(tp) match { case bounds: TypeBounds => wildApprox(WildcardType(bounds)) case NoType => WildcardType(wildApprox(poly.paramBounds(pnum)).bounds) diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index 5ef3a768c..2ec510a3d 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -30,10 +30,10 @@ trait TypeAssigner { /** An upper approximation of the given type `tp` that does not refer to any symbol in `symsToAvoid`. * Approximation steps are: - * + * * - follow aliases if the original refers to a forbidden symbol * - widen termrefs that refer to a forbidden symbol - * - replace ClassInfos of forbidden classes by the intersection of their parents, refined by all + * - replace ClassInfos of forbidden classes by the intersection of their parents, refined by all * non-private fields, methods, and type members. * - drop refinements referring to a forbidden symbol. */ diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index b066f1fc1..6befe58df 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -402,8 +402,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit typed(cpy.Apply(lhs)(untpd.Select(fn, nme.update), args :+ tree.rhs), pt) case untpd.TypedSplice(Apply(MaybePoly(Select(fn, app), targs), args)) if app == nme.apply => val rawUpdate: untpd.Tree = untpd.Select(untpd.TypedSplice(fn), nme.update) - val wrappedUpdate = - if (targs.isEmpty) rawUpdate + val wrappedUpdate = + if (targs.isEmpty) rawUpdate else untpd.TypeApply(rawUpdate, targs map untpd.TypedSplice) val appliedUpdate = cpy.Apply(fn)(wrappedUpdate, (args map untpd.TypedSplice) :+ tree.rhs) typed(appliedUpdate, pt) @@ -471,7 +471,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit */ protected def ensureNoLocalRefs(tree: Tree, pt: Type, localSyms: => List[Symbol], forcedDefined: Boolean = false)(implicit ctx: Context): Tree = { def ascribeType(tree: Tree, pt: Type): Tree = tree match { - case block @ Block(stats, expr) => + case block @ Block(stats, expr) => val expr1 = ascribeType(expr, pt) cpy.Block(block)(stats, expr1) withType expr1.tpe // no assignType here because avoid is redundant case _ => @@ -722,8 +722,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if (tree.from.isEmpty) enclMethInfo(ctx) else { val from = tree.from.asInstanceOf[tpd.Tree] - val proto = - if (ctx.erasedTypes) from.symbol.info.finalResultType + val proto = + if (ctx.erasedTypes) from.symbol.info.finalResultType else WildcardType // We cannot reliably detect the internal type view of polymorphic or dependent methods // because we do not know the internal type params and method params. // Hence no adaptation is possible, and we assume WildcardType as prototype. -- cgit v1.2.3