Skip to content

Commit 595f245

Browse files
committed
Merge pull request #565 from retronym/topic/cleanups
Fix typos, scaladoc tags, and some minor code smells.
2 parents 0679784 + ea71c6f commit 595f245

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+112
-119
lines changed

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

Lines changed: 3 additions & 3 deletions
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.isJavaEntryPoint(tree.symbol)) {
4444
ctx.genBCodePhase.asInstanceOf[GenBCode].registerEntryPoint(tree.symbol)
4545
}
4646
tree
@@ -60,7 +60,7 @@ object CollectEntryPoints{
6060
})
6161
}
6262

63-
def isJavaEntyPoint(sym: Symbol)(implicit ctx: Context): Boolean = {
63+
def isJavaEntryPoint(sym: Symbol)(implicit ctx: Context): Boolean = {
6464
import Types.MethodType
6565
val d = ctx.definitions
6666
val StringType = d.StringType
@@ -105,7 +105,7 @@ object CollectEntryPoints{
105105
failNoForwarder("companion contains its own main method (implementation restriction: no main is allowed, regardless of signature)")
106106
else if (companion.flags is Flags.Trait)
107107
failNoForwarder("companion is a trait")
108-
// Now either succeeed, or issue some additional warnings for things which look like
108+
// Now either succeed, or issue some additional warnings for things which look like
109109
// attempts to be java main methods.
110110
else (possibles exists(x=> isJavaMainMethod(x.symbol))) || {
111111
possibles exists { m =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
617617
def hasAnnotation(sym: Symbol): Boolean = false
618618
def shouldEmitForwarders: Boolean = //exitingPickler { !(sym.name.toString contains '$')
619619
(sym is Flags.Module) && !(sym is Flags.ImplClass) /// !sym.isNestedClass
620-
def isJavaEntryPoint: Boolean = CollectEntryPoints.isJavaEntyPoint(sym)
620+
def isJavaEntryPoint: Boolean = CollectEntryPoints.isJavaEntryPoint(sym)
621621

622622
def isClassConstructor: Boolean = toDenot(sym).isClassConstructor
623623

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
342342
tree match {
343343
case EmptyTree => ()
344344
case PackageDef(_, stats) => stats foreach gen
345-
case ValDef(name, tpt, rhs) => () // module val not emmited
345+
case ValDef(name, tpt, rhs) => () // module val not emitted
346346
case cd: TypeDef =>
347347
q1 add Item1(arrivalPos, cd, int.currentUnit)
348348
arrivalPos += 1

src/dotty/tools/dotc/Run.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class Run(comp: Compiler)(implicit ctx: Context) {
3737
throw ex
3838
}
3939

40-
/** TODO: There's a fundamental design problem here: We assmble phases using `squash`
40+
/** TODO: There's a fundamental design problem here: We assemble phases using `squash`
4141
* when we first build the compiler. But we modify them with -Yskip, -Ystop
42-
* on each run. That modification needs to either trasnform the tree structure,
43-
* or we need to assmeble phases on each run, and take -Yskip, -Ystop into
42+
* on each run. That modification needs to either transform the tree structure,
43+
* or we need to assemble phases on each run, and take -Yskip, -Ystop into
4444
* account. I think the latter would be preferable.
4545
*/
4646
def compileSources(sources: List[SourceFile]) =
@@ -67,9 +67,9 @@ class Run(comp: Compiler)(implicit ctx: Context) {
6767
private def printTree(ctx: Context) = {
6868
val unit = ctx.compilationUnit
6969
val prevPhase = ctx.phase.prev // can be a mini-phase
70-
val squahsedPhase = ctx.squashed(prevPhase)
70+
val squashedPhase = ctx.squashed(prevPhase)
7171

72-
println(s"result of $unit after ${squahsedPhase}:")
72+
println(s"result of $unit after ${squashedPhase}:")
7373
println(unit.tpdTree.show(ctx))
7474
}
7575

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object desugar {
3636
/** Make sure that for all enclosing module classes their companion lasses
3737
* are completed. Reason: We need the constructor of such companion classes to
3838
* be completed so that OriginalSymbol attachments are pushed to DerivedTypeTrees
39-
* in appy/unapply methods.
39+
* in apply/unapply methods.
4040
*/
4141
override def ensureCompletions(implicit ctx: Context) =
4242
if (!(ctx.owner is Package))
@@ -335,7 +335,7 @@ object desugar {
335335
.withMods(synthetic))
336336
.withPos(cdef.pos).toList
337337

338-
// The companion object defifinitions, if a companion is needed, Nil otherwise.
338+
// The companion object definitions, if a companion is needed, Nil otherwise.
339339
// companion definitions include:
340340
// 1. If class is a case class case class C[Ts](p1: T1, ..., pN: TN)(moreParams):
341341
// def apply[Ts](p1: T1, ..., pN: TN)(moreParams) = new C[Ts](p1, ..., pN)(moreParams) (unless C is abstract)
@@ -598,8 +598,8 @@ object desugar {
598598
}
599599
}
600600

601-
/** Create tree for for-comprehension <for (enums) do body> or
602-
* <for (enums) yield body> where mapName and flatMapName are chosen
601+
/** Create tree for for-comprehension `<for (enums) do body>` or
602+
* `<for (enums) yield body>` where mapName and flatMapName are chosen
603603
* corresponding to whether this is a for-do or a for-yield.
604604
* The creation performs the following rewrite rules:
605605
*
@@ -638,7 +638,7 @@ object desugar {
638638
* TupleN(x_1, ..., x_N)
639639
* } ...)
640640
*
641-
* If any of the P_i are variable patterns, the corresponding `x_i @ P_i' is not generated
641+
* If any of the P_i are variable patterns, the corresponding `x_i @ P_i` is not generated
642642
* and the variable constituting P_i is used instead of x_i
643643
*
644644
* @param mapName The name to be used for maps (either map or foreach)
@@ -872,7 +872,7 @@ object desugar {
872872
* trait <refinement> extends C { this: T1 => type T <: A }
873873
*
874874
* The result of this method is used for validity checking, is thrown away afterwards.
875-
* @param parentType The type of `parent`
875+
* @param parent The type of `parent`
876876
*/
877877
def refinedTypeToClass(parent: tpd.Tree, refinements: List[Tree])(implicit ctx: Context): TypeDef = {
878878
def stripToCore(tp: Type): List[Type] = tp match {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
256256
case y => y
257257
}
258258

259-
/** Checks whether predicate `p` is true for all result parts of this epression,
259+
/** Checks whether predicate `p` is true for all result parts of this expression,
260260
* where we zoom into Ifs, Matches, and Blocks.
261261
*/
262262
def forallResults(tree: Tree, p: Tree => Boolean): Boolean = tree match {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import dotty.tools.dotc.transform.SymUtils._
2525
* The reason the substitution is broken out from the rest of the type map is
2626
* that all symbols have to be substituted at the same time. If we do not do this,
2727
* we risk data races on named types. Example: Say we have `outer#1.inner#2` and we
28-
* have two substitutons S1 = [outer#1 := outer#3], S2 = [inner#2 := inner#4] where
28+
* have two substitutions S1 = [outer#1 := outer#3], S2 = [inner#2 := inner#4] where
2929
* hashtags precede symbol ids. If we do S1 first, we get outer#2.inner#3. If we then
3030
* do S2 we get outer#2.inner#4. But that means that the named type outer#2.inner
3131
* gets two different denotations in the same period. Hence, if -Yno-double-bindings is

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

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,7 @@ object Trees {
3232
* @param flags The set flags
3333
* @param privateWithin If a private or protected has is followed by a
3434
* qualifier [q], the name q, "" as a typename otherwise.
35-
* @param annotations The annotations preceding the modifers
36-
* @param positions A flagPositions structure that records the positions
37-
* of et flags.
38-
* @param pos The position of the modifiers. This should start with
39-
* the first modifier or annotation and have as point
40-
* the start of the opening keyword(s) of the definition.
41-
* It should have as end the end of the opening keywords(s).
42-
* If there is no opening keyword, point should equal end.
35+
* @param annotations The annotations preceding the modifiers
4336
*/
4437
case class Modifiers[-T >: Untyped] (
4538
flags: FlagSet = EmptyFlags,
@@ -222,7 +215,7 @@ object Trees {
222215
s
223216
}
224217

225-
/** If this is a thicket, gerform `op` on each of its trees
218+
/** If this is a thicket, perform `op` on each of its trees
226219
* otherwise, perform `op` ion tree itself.
227220
*/
228221
def foreachInThicket(op: Tree[T] => Unit): Unit = op(this)
@@ -368,7 +361,7 @@ object Trees {
368361
case class This[-T >: Untyped] private[ast] (qual: TypeName)
369362
extends DenotingTree[T] with TermTree[T] {
370363
type ThisTree[-T >: Untyped] = This[T]
371-
// Denotation of a This tree is always the udnerlying class; needs correction for modules.
364+
// Denotation of a This tree is always the underlying class; needs correction for modules.
372365
override def denot(implicit ctx: Context): Denotation = {
373366
tpe match {
374367
case tpe @ TermRef(pre, _) if tpe.symbol is Module =>
@@ -897,7 +890,7 @@ object Trees {
897890
case tree: BackquotedIdent =>
898891
if (name == tree.name) tree
899892
else finalize(tree, new BackquotedIdent(name))
900-
case tree: Ident if (name == tree.name) => tree
893+
case tree: Ident if name == tree.name => tree
901894
case _ => finalize(tree, untpd.Ident(name))
902895
}
903896
def Select(tree: Tree)(qualifier: Tree, name: Name)(implicit ctx: Context): Select = tree match {
@@ -908,7 +901,7 @@ object Trees {
908901
case _ => finalize(tree, untpd.Select(qualifier, name))
909902
}
910903
def This(tree: Tree)(qual: TypeName): This = tree match {
911-
case tree: This if (qual == tree.qual) => tree
904+
case tree: This if qual == tree.qual => tree
912905
case _ => finalize(tree, untpd.This(qual))
913906
}
914907
def Super(tree: Tree)(qual: Tree, mix: TypeName): Super = tree match {
@@ -924,11 +917,11 @@ object Trees {
924917
case _ => finalize(tree, untpd.TypeApply(fun, args))
925918
}
926919
def Literal(tree: Tree)(const: Constant)(implicit ctx: Context): Literal = tree match {
927-
case tree: Literal if (const == tree.const) => tree
920+
case tree: Literal if const == tree.const => tree
928921
case _ => finalize(tree, untpd.Literal(const))
929922
}
930923
def New(tree: Tree)(tpt: Tree)(implicit ctx: Context): New = tree match {
931-
case tree: New if (tpt eq tree.tpt) => tree
924+
case tree: New if tpt eq tree.tpt => tree
932925
case _ => finalize(tree, untpd.New(tpt))
933926
}
934927
def Pair(tree: Tree)(left: Tree, right: Tree)(implicit ctx: Context): Pair = tree match {
@@ -979,15 +972,15 @@ object Trees {
979972
case tree: JavaSeqLiteral =>
980973
if (elems eq tree.elems) tree
981974
else finalize(tree, new JavaSeqLiteral(elems))
982-
case tree: SeqLiteral if (elems eq tree.elems) => tree
975+
case tree: SeqLiteral if elems eq tree.elems => tree
983976
case _ => finalize(tree, untpd.SeqLiteral(elems))
984977
}
985978
def TypeTree(tree: Tree)(original: Tree): TypeTree = tree match {
986979
case tree: TypeTree if original eq tree.original => tree
987980
case _ => finalize(tree, untpd.TypeTree(original))
988981
}
989982
def SingletonTypeTree(tree: Tree)(ref: Tree): SingletonTypeTree = tree match {
990-
case tree: SingletonTypeTree if (ref eq tree.ref) => tree
983+
case tree: SingletonTypeTree if ref eq tree.ref => tree
991984
case _ => finalize(tree, untpd.SingletonTypeTree(ref))
992985
}
993986
def SelectFromTypeTree(tree: Tree)(qualifier: Tree, name: Name): SelectFromTypeTree = tree match {
@@ -1011,7 +1004,7 @@ object Trees {
10111004
case _ => finalize(tree, untpd.AppliedTypeTree(tpt, args))
10121005
}
10131006
def ByNameTypeTree(tree: Tree)(result: Tree): ByNameTypeTree = tree match {
1014-
case tree: ByNameTypeTree if (result eq tree.result) => tree
1007+
case tree: ByNameTypeTree if result eq tree.result => tree
10151008
case _ => finalize(tree, untpd.ByNameTypeTree(result))
10161009
}
10171010
def TypeBoundsTree(tree: Tree)(lo: Tree, hi: Tree): TypeBoundsTree = tree match {
@@ -1023,7 +1016,7 @@ object Trees {
10231016
case _ => finalize(tree, untpd.Bind(name, body))
10241017
}
10251018
def Alternative(tree: Tree)(trees: List[Tree]): Alternative = tree match {
1026-
case tree: Alternative if (trees eq tree.trees) => tree
1019+
case tree: Alternative if trees eq tree.trees => tree
10271020
case _ => finalize(tree, untpd.Alternative(trees))
10281021
}
10291022
def UnApply(tree: Tree)(fun: Tree, implicits: List[Tree], patterns: List[Tree]): UnApply = tree match {
@@ -1059,7 +1052,7 @@ object Trees {
10591052
case _ => finalize(tree, untpd.Annotated(annot, arg))
10601053
}
10611054
def Thicket(tree: Tree)(trees: List[Tree]): Thicket = tree match {
1062-
case tree: Thicket if (trees eq tree.trees) => tree
1055+
case tree: Thicket if trees eq tree.trees => tree
10631056
case _ => finalize(tree, untpd.Thicket(trees))
10641057
}
10651058

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
458458
override def Select(tree: Tree)(qualifier: Tree, name: Name)(implicit ctx: Context): Select = {
459459
val tree1 = untpd.cpy.Select(tree)(qualifier, name)
460460
tree match {
461-
case tree: Select if (qualifier.tpe eq tree.qualifier.tpe) =>
461+
case tree: Select if qualifier.tpe eq tree.qualifier.tpe =>
462462
tree1.withTypeUnchecked(tree.tpe)
463463
case _ => tree.tpe match {
464464
case tpe: NamedType => tree1.withType(tpe.derivedSelect(qualifier.tpe))
@@ -504,7 +504,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
504504
override def Block(tree: Tree)(stats: List[Tree], expr: Tree)(implicit ctx: Context): Block = {
505505
val tree1 = untpd.cpy.Block(tree)(stats, expr)
506506
tree match {
507-
case tree: Block if (expr.tpe eq tree.expr.tpe) => tree1.withTypeUnchecked(tree.tpe)
507+
case tree: Block if expr.tpe eq tree.expr.tpe => tree1.withTypeUnchecked(tree.tpe)
508508
case _ => ta.assignType(tree1, stats, expr)
509509
}
510510
}
@@ -532,7 +532,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
532532
override def CaseDef(tree: Tree)(pat: Tree, guard: Tree, body: Tree)(implicit ctx: Context): CaseDef = {
533533
val tree1 = untpd.cpy.CaseDef(tree)(pat, guard, body)
534534
tree match {
535-
case tree: CaseDef if (body.tpe eq tree.body.tpe) => tree1.withTypeUnchecked(tree.tpe)
535+
case tree: CaseDef if body.tpe eq tree.body.tpe => tree1.withTypeUnchecked(tree.tpe)
536536
case _ => ta.assignType(tree1, body)
537537
}
538538
}
@@ -543,7 +543,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
543543
override def Try(tree: Tree)(expr: Tree, cases: List[CaseDef], finalizer: Tree)(implicit ctx: Context): Try = {
544544
val tree1 = untpd.cpy.Try(tree)(expr, cases, finalizer)
545545
tree match {
546-
case tree: Try if (expr.tpe eq tree.expr.tpe) && (sameTypes(cases, tree.cases)) => tree1.withTypeUnchecked(tree.tpe)
546+
case tree: Try if (expr.tpe eq tree.expr.tpe) && sameTypes(cases, tree.cases) => tree1.withTypeUnchecked(tree.tpe)
547547
case _ => ta.assignType(tree1, expr, cases)
548548
}
549549
}
@@ -814,7 +814,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
814814
expectedType match {
815815
case defn.ArrayType(el) =>
816816
lastParam.tpe match {
817-
case defn.ArrayType(el2) if (el2 <:< el) =>
817+
case defn.ArrayType(el2) if el2 <:< el =>
818818
// we have a JavaSeqLiteral with a more precise type
819819
// we cannot construct a tree as JavaSeqLiteral infered to precise type
820820
// if we add typed than it would be both type-correct and
@@ -865,7 +865,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
865865
}
866866
}
867867

868-
/** A traverser that passes the enlcosing class or method as an argumenr
868+
/** A traverser that passes the enclosing class or method as an argument
869869
* to the traverse method.
870870
*/
871871
abstract class EnclosingMethodTraverser extends TreeAccumulator[Symbol] {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
274274
case _ => new PolyTypeDef(name, tparams, rhs).withPos(tree.pos)
275275
}
276276
def SymbolLit(tree: Tree)(str: String) = tree match {
277-
case tree: SymbolLit if (str == tree.str) => tree
277+
case tree: SymbolLit if str == tree.str => tree
278278
case _ => untpd.SymbolLit(str).withPos(tree.pos)
279279
}
280280
def InterpolatedString(tree: Tree)(id: TermName, strings: List[Literal], elems: List[Tree]) = tree match {
@@ -298,15 +298,15 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
298298
case _ => untpd.PrefixOp(op, od).withPos(tree.pos)
299299
}
300300
def Parens(tree: Tree)(t: Tree) = tree match {
301-
case tree: Parens if (t eq tree.t) => tree
301+
case tree: Parens if t eq tree.t => tree
302302
case _ => untpd.Parens(t).withPos(tree.pos)
303303
}
304304
def Tuple(tree: Tree)(trees: List[Tree]) = tree match {
305-
case tree: Tuple if (trees eq tree.trees) => tree
305+
case tree: Tuple if trees eq tree.trees => tree
306306
case _ => untpd.Tuple(trees).withPos(tree.pos)
307307
}
308308
def Throw(tree: Tree)(expr: Tree) = tree match {
309-
case tree: Throw if (expr eq tree.expr) => tree
309+
case tree: Throw if expr eq tree.expr => tree
310310
case _ => untpd.Throw(expr).withPos(tree.pos)
311311
}
312312
def WhileDo(tree: Tree)(cond: Tree, body: Tree) = tree match {

src/dotty/tools/dotc/config/Config.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object Config {
1010

1111
final val checkCacheMembersNamed = false
1212

13-
/** When updating a connstraint bound, check that the constrained parameter
13+
/** When updating a constraint bound, check that the constrained parameter
1414
* does not appear at the top-level of either of its bounds.
1515
*/
1616
final val checkConstraintsNonCyclic = false
@@ -56,7 +56,7 @@ object Config {
5656
final val fastPathForRefinedSubtype = true
5757

5858
/** When set, use new signature-based matching.
59-
* Advantantage of doing so: It's supposed to be faster
59+
* Advantage of doing so: It's supposed to be faster
6060
* Disadvantage: It might hide inconsistencies, so while debugging it's better to turn it off
6161
*/
6262
final val newMatch = false

0 commit comments

Comments
 (0)