Skip to content

Commit 52a1d91

Browse files
committed
Ensure spaces after if in Dotty source.
1 parent d080478 commit 52a1d91

24 files changed

+51
-51
lines changed

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ object DottyBuild extends Build {
109109
val path = for {
110110
file <- attList.map(_.data)
111111
path = file.getAbsolutePath
112-
prefix = if(path.endsWith(".jar")) "p" else "a"
112+
prefix = if (path.endsWith(".jar")) "p" else "a"
113113
} yield "-Xbootclasspath/" + prefix + ":" + path
114114
// dotty itself needs to be in the bootclasspath
115115
val fullpath = ("-Xbootclasspath/a:" + bin) :: path.toList

src/dotty/tools/backend/jvm/CollectEntryPoints.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CollectEntryPoints extends MiniPhaseTransform {
4040
def phaseName: String = "Collect entry points"
4141

4242
override def transformDefDef(tree: tpd.DefDef)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = {
43-
if((tree.symbol ne NoSymbol) && CollectEntryPoints.isJavaEntyPoint(tree.symbol)) {
43+
if ((tree.symbol ne NoSymbol) && CollectEntryPoints.isJavaEntyPoint(tree.symbol)) {
4444
ctx.genBCodePhase.asInstanceOf[GenBCode].registerEntryPoint(tree.symbol)
4545
}
4646
tree

src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
376376
def shouldEmitJumpAfterLabels = true
377377

378378
def dumpClasses: Option[String] =
379-
if(ctx.settings.Ydumpclasses.isDefault) None
379+
if (ctx.settings.Ydumpclasses.isDefault) None
380380
else Some(ctx.settings.Ydumpclasses.value)
381381

382382
def mainClass: Option[String] =
@@ -423,7 +423,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
423423
case TermRef(prefix: ThisType, name) =>
424424
Some(tpd.This(prefix.cls).select(i.symbol))
425425
case TermRef(NoPrefix, name) =>
426-
if(i.symbol is Flags.Method) Some(This(i.symbol.enclosingClass).select(i.symbol)) // workaround #342 todo: remove after fixed
426+
if (i.symbol is Flags.Method) Some(This(i.symbol.enclosingClass).select(i.symbol)) // workaround #342 todo: remove after fixed
427427
else None
428428
case _ => None
429429
}
@@ -663,7 +663,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
663663
def companionSymbol: Symbol = if (sym is Flags.Module) companionClass else companionModule
664664
def moduleClass: Symbol = toDenot(sym).moduleClass
665665
def enclosingClassSym: Symbol = {
666-
if(this.isClass) {
666+
if (this.isClass) {
667667
val ct = ctx.withPhase(ctx.flattenPhase.prev)
668668
toDenot(sym)(ct).owner.enclosingClass(ct)
669669
}
@@ -792,7 +792,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
792792
t.info match {
793793

794794
case _ =>
795-
if(!t.symbol.isClass) nonClassTypeRefToBType(t.symbol) // See comment on nonClassTypeRefToBType
795+
if (!t.symbol.isClass) nonClassTypeRefToBType(t.symbol) // See comment on nonClassTypeRefToBType
796796
else primitiveOrClassToBType(t.symbol) // Common reference to a type such as scala.Int or java.lang.String
797797
}
798798
case Types.ClassInfo(_, sym, _, _, _) => primitiveOrClassToBType(sym) // We get here, for example, for genLoadModule, which invokes toTypeKind(moduleClassSymbol.info)
@@ -942,7 +942,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
942942
def _3: Tree = field.rhs
943943

944944
override def unapply(s: LabelDef): DottyBackendInterface.this.LabelDef.type = {
945-
if(s.symbol is Flags.Label) this.field = s
945+
if (s.symbol is Flags.Label) this.field = s
946946
else this.field = null
947947
this
948948
}
@@ -1021,11 +1021,11 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
10211021
def _2 = field.meth
10221022
def _3 = {
10231023
val t = field.tpt.tpe.typeSymbol
1024-
if(t.exists) t
1024+
if (t.exists) t
10251025
else {
10261026
val arity = field.meth.tpe.widenDealias.paramTypes.size - _1.size
10271027
val returnsUnit = field.meth.tpe.widenDealias.resultType.classSymbol == UnitClass
1028-
if(returnsUnit)
1028+
if (returnsUnit)
10291029
ctx.requiredClass(("scala.compat.java8.JProcedure" + arity).toTermName)
10301030
else ctx.requiredClass(("scala.compat.java8.JFunction" + arity).toTermName)
10311031
}

src/dotty/tools/backend/jvm/LabelDefs.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import StdNames.nme
4444
*
4545
* <label> def foo(i: Int) = {
4646
* <label> def bar = 0
47-
* <label> def dough(i: Int) = if(i == 0) bar else foo(i-1)
47+
* <label> def dough(i: Int) = if (i == 0) bar else foo(i-1)
4848
* dough(i)
4949
* }
5050
*
@@ -54,7 +54,7 @@ import StdNames.nme
5454
*
5555
* \
5656
* <label> def foo(i: Int) = dough(i)
57-
* <label> def dough(i: Int) = if(i == 0) bar else foo(i-1)
57+
* <label> def dough(i: Int) = if (i == 0) bar else foo(i-1)
5858
* <label> def bar = 2
5959
* foo(100)
6060
*
@@ -64,7 +64,7 @@ import StdNames.nme
6464
* <jump foo>
6565
* <label> def foo(i: Int) = dough(i)
6666
* // <jump a> // unreachable
67-
* <label> def dough(i: Int) = if(i == 0) bar else foo(i-1)
67+
* <label> def dough(i: Int) = if (i == 0) bar else foo(i-1)
6868
* // <jump a> // unreachable
6969
* <label> def bar = 2
7070
* // <jump a> // unreachable
@@ -107,7 +107,7 @@ class LabelDefs extends MiniPhaseTransform {
107107
labelLevel = labelLevel + 1
108108
val r = Block(moveLabels(t), t)
109109
labelLevel = labelLevel - 1
110-
if(labelLevel == 0) beingAppended.clear()
110+
if (labelLevel == 0) beingAppended.clear()
111111
r
112112
case _ => if (entryPoints.nonEmpty && labelDefs.nonEmpty) super.transform(tree) else tree
113113
}
@@ -206,14 +206,14 @@ class LabelDefs extends MiniPhaseTransform {
206206
labelCalls(r.symbol) = parentLabelCalls
207207
parentLabelCalls = st
208208

209-
if(shouldMoveLabel) {
209+
if (shouldMoveLabel) {
210210
labelDefs(r.symbol) = r
211211
EmptyTree
212212
} else r
213213
case t: Apply if t.symbol is Flags.Label =>
214214
val sym = t.symbol
215215
parentLabelCalls = parentLabelCalls + t
216-
if(owner != sym) callCounts(sym) = callCounts(sym) + 1
216+
if (owner != sym) callCounts(sym) = callCounts(sym) + 1
217217
super.transform(tree)
218218
case _ =>
219219
super.transform(tree)

src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
776776
} else args
777777
}
778778

779-
val callArgs: List[Tree] = if(args.isEmpty) Nil else {
779+
val callArgs: List[Tree] = if (args.isEmpty) Nil else {
780780
val expectedType = selected.widen.paramTypess.head.last
781781
val lastParam = args.last
782782
adaptLastArg(lastParam, expectedType)

src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ trait Symbols { this: Context =>
162162
privateWithin, coord, assocFile)
163163

164164
def synthesizeCompanionMethod(name: Name, target: SymDenotation, owner: SymDenotation)(implicit ctx: Context) =
165-
if(owner.exists && target.exists && !owner.isAbsent && !target.isAbsent) {
165+
if (owner.exists && target.exists && !owner.isAbsent && !target.isAbsent) {
166166
val existing = owner.unforcedDecls.lookup(name)
167167

168168
existing.orElse{

src/dotty/tools/dotc/core/TypeErasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ object TypeErasure {
9595
def erasure(tp: Type)(implicit ctx: Context): Type = scalaErasureFn(tp)(erasureCtx)
9696
def semiErasure(tp: Type)(implicit ctx: Context): Type = semiErasureFn(tp)(erasureCtx)
9797
def sigName(tp: Type, isJava: Boolean)(implicit ctx: Context): TypeName = {
98-
val seqClass = if(isJava) defn.ArrayClass else defn.SeqClass
98+
val seqClass = if (isJava) defn.ArrayClass else defn.SeqClass
9999
val normTp =
100100
if (tp.isRepeatedParam) tp.translateParameterized(defn.RepeatedParamClass, seqClass)
101101
else tp

src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ object Types {
7676

7777
val uniqId = {
7878
nextId = nextId + 1
79-
// if(nextId == 19555)
79+
// if (nextId == 19555)
8080
// println("foo")
8181
nextId
8282
}

src/dotty/tools/dotc/core/pickling/ClassfileParser.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class ClassfileParser(
9292
if (c != classRoot.symbol) mismatchError(c)
9393
}
9494

95-
if(classRoot.symbol.id == 4812) {
95+
if (classRoot.symbol.id == 4812) {
9696
println("bar")
9797
}
9898

src/dotty/tools/dotc/parsing/JavaParsers.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ object JavaParsers {
121121
case nil => (EmptyTree, nil)
122122
}
123123
var (constr1, stats1) = pullOutFirstConstr(stats)
124-
if(constr1 == EmptyTree) constr1 = makeConstructor(List(), tparams)
124+
if (constr1 == EmptyTree) constr1 = makeConstructor(List(), tparams)
125125
// A dummy first constructor is needed for Java classes so that the real constructors see the
126126
// import of the companion object. The constructor has parameter of type Unit so no Java code
127127
// can call it.
128-
if(needsDummyConstr) {
128+
if (needsDummyConstr) {
129129
stats1 = constr1 :: stats1
130130
constr1 = makeConstructor(List(scalaDot(tpnme.Unit)), tparams, Flags.JavaDefined | Flags.PrivateLocal)
131131
}
@@ -579,9 +579,9 @@ object JavaParsers {
579579
def varDecl(pos: Position, mods: Modifiers, tpt: Tree, name: TermName): ValDef = {
580580
val tpt1 = optArrayBrackets(tpt)
581581
if (in.token == EQUALS && !(mods is Flags.Param)) skipTo(COMMA, SEMI)
582-
val mods1 = if(mods is Flags.Final) mods else mods | Flags.Mutable
582+
val mods1 = if (mods is Flags.Final) mods else mods | Flags.Mutable
583583
atPos(pos) {
584-
ValDef(name, tpt1, if(mods is Flags.Param) EmptyTree else unimplementedExpr).withMods(mods1)
584+
ValDef(name, tpt1, if (mods is Flags.Param) EmptyTree else unimplementedExpr).withMods(mods1)
585585
}
586586
}
587587

0 commit comments

Comments
 (0)