Skip to content

Fix typos, scaladoc tags, and some minor code smells. #565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/dotty/tools/backend/jvm/CollectEntryPoints.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CollectEntryPoints extends MiniPhaseTransform {
def phaseName: String = "Collect entry points"

override def transformDefDef(tree: tpd.DefDef)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = {
if ((tree.symbol ne NoSymbol) && CollectEntryPoints.isJavaEntyPoint(tree.symbol)) {
if ((tree.symbol ne NoSymbol) && CollectEntryPoints.isJavaEntryPoint(tree.symbol)) {
ctx.genBCodePhase.asInstanceOf[GenBCode].registerEntryPoint(tree.symbol)
}
tree
Expand All @@ -60,7 +60,7 @@ object CollectEntryPoints{
})
}

def isJavaEntyPoint(sym: Symbol)(implicit ctx: Context): Boolean = {
def isJavaEntryPoint(sym: Symbol)(implicit ctx: Context): Boolean = {
import Types.MethodType
val d = ctx.definitions
val StringType = d.StringType
Expand Down Expand Up @@ -105,7 +105,7 @@ object CollectEntryPoints{
failNoForwarder("companion contains its own main method (implementation restriction: no main is allowed, regardless of signature)")
else if (companion.flags is Flags.Trait)
failNoForwarder("companion is a trait")
// Now either succeeed, or issue some additional warnings for things which look like
// Now either succeed, or issue some additional warnings for things which look like
// attempts to be java main methods.
else (possibles exists(x=> isJavaMainMethod(x.symbol))) || {
possibles exists { m =>
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/backend/jvm/DottyBackendInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
def hasAnnotation(sym: Symbol): Boolean = false
def shouldEmitForwarders: Boolean = //exitingPickler { !(sym.name.toString contains '$')
(sym is Flags.Module) && !(sym is Flags.ImplClass) /// !sym.isNestedClass
def isJavaEntryPoint: Boolean = CollectEntryPoints.isJavaEntyPoint(sym)
def isJavaEntryPoint: Boolean = CollectEntryPoints.isJavaEntryPoint(sym)

def isClassConstructor: Boolean = toDenot(sym).isClassConstructor

Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/backend/jvm/GenBCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
tree match {
case EmptyTree => ()
case PackageDef(_, stats) => stats foreach gen
case ValDef(name, tpt, rhs) => () // module val not emmited
case ValDef(name, tpt, rhs) => () // module val not emitted
case cd: TypeDef =>
q1 add Item1(arrivalPos, cd, int.currentUnit)
arrivalPos += 1
Expand Down
10 changes: 5 additions & 5 deletions src/dotty/tools/dotc/Run.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class Run(comp: Compiler)(implicit ctx: Context) {
throw ex
}

/** TODO: There's a fundamental design problem here: We assmble phases using `squash`
/** TODO: There's a fundamental design problem here: We assemble phases using `squash`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is out-of-date. We already assemble phases on each run.

* when we first build the compiler. But we modify them with -Yskip, -Ystop
* on each run. That modification needs to either trasnform the tree structure,
* or we need to assmeble phases on each run, and take -Yskip, -Ystop into
* on each run. That modification needs to either transform the tree structure,
* or we need to assemble phases on each run, and take -Yskip, -Ystop into
* account. I think the latter would be preferable.
*/
def compileSources(sources: List[SourceFile]) =
Expand All @@ -67,9 +67,9 @@ class Run(comp: Compiler)(implicit ctx: Context) {
private def printTree(ctx: Context) = {
val unit = ctx.compilationUnit
val prevPhase = ctx.phase.prev // can be a mini-phase
val squahsedPhase = ctx.squashed(prevPhase)
val squashedPhase = ctx.squashed(prevPhase)

println(s"result of $unit after ${squahsedPhase}:")
println(s"result of $unit after ${squashedPhase}:")
println(unit.tpdTree.show(ctx))
}

Expand Down
12 changes: 6 additions & 6 deletions src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object desugar {
/** Make sure that for all enclosing module classes their companion lasses
* are completed. Reason: We need the constructor of such companion classes to
* be completed so that OriginalSymbol attachments are pushed to DerivedTypeTrees
* in appy/unapply methods.
* in apply/unapply methods.
*/
override def ensureCompletions(implicit ctx: Context) =
if (!(ctx.owner is Package))
Expand Down Expand Up @@ -335,7 +335,7 @@ object desugar {
.withMods(synthetic))
.withPos(cdef.pos).toList

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

/** Create tree for for-comprehension <for (enums) do body> or
* <for (enums) yield body> where mapName and flatMapName are chosen
/** Create tree for for-comprehension `<for (enums) do body>` or
* `<for (enums) yield body>` where mapName and flatMapName are chosen
* corresponding to whether this is a for-do or a for-yield.
* The creation performs the following rewrite rules:
*
Expand Down Expand Up @@ -638,7 +638,7 @@ object desugar {
* TupleN(x_1, ..., x_N)
* } ...)
*
* If any of the P_i are variable patterns, the corresponding `x_i @ P_i' is not generated
* If any of the P_i are variable patterns, the corresponding `x_i @ P_i` is not generated
* and the variable constituting P_i is used instead of x_i
*
* @param mapName The name to be used for maps (either map or foreach)
Expand Down Expand Up @@ -872,7 +872,7 @@ object desugar {
* trait <refinement> extends C { this: T1 => type T <: A }
*
* The result of this method is used for validity checking, is thrown away afterwards.
* @param parentType The type of `parent`
* @param parent The type of `parent`
*/
def refinedTypeToClass(parent: tpd.Tree, refinements: List[Tree])(implicit ctx: Context): TypeDef = {
def stripToCore(tp: Type): List[Type] = tp match {
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/ast/TreeInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
case y => y
}

/** Checks whether predicate `p` is true for all result parts of this epression,
/** Checks whether predicate `p` is true for all result parts of this expression,
* where we zoom into Ifs, Matches, and Blocks.
*/
def forallResults(tree: Tree, p: Tree => Boolean): Boolean = tree match {
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/ast/TreeTypeMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import dotty.tools.dotc.transform.SymUtils._
* The reason the substitution is broken out from the rest of the type map is
* that all symbols have to be substituted at the same time. If we do not do this,
* we risk data races on named types. Example: Say we have `outer#1.inner#2` and we
* have two substitutons S1 = [outer#1 := outer#3], S2 = [inner#2 := inner#4] where
* have two substitutions S1 = [outer#1 := outer#3], S2 = [inner#2 := inner#4] where
* hashtags precede symbol ids. If we do S1 first, we get outer#2.inner#3. If we then
* do S2 we get outer#2.inner#4. But that means that the named type outer#2.inner
* gets two different denotations in the same period. Hence, if -Yno-double-bindings is
Expand Down
31 changes: 12 additions & 19 deletions src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ object Trees {
* @param flags The set flags
* @param privateWithin If a private or protected has is followed by a
* qualifier [q], the name q, "" as a typename otherwise.
* @param annotations The annotations preceding the modifers
* @param positions A flagPositions structure that records the positions
* of et flags.
* @param pos The position of the modifiers. This should start with
* the first modifier or annotation and have as point
* the start of the opening keyword(s) of the definition.
* It should have as end the end of the opening keywords(s).
* If there is no opening keyword, point should equal end.
* @param annotations The annotations preceding the modifiers
*/
case class Modifiers[-T >: Untyped] (
flags: FlagSet = EmptyFlags,
Expand Down Expand Up @@ -222,7 +215,7 @@ object Trees {
s
}

/** If this is a thicket, gerform `op` on each of its trees
/** If this is a thicket, perform `op` on each of its trees
* otherwise, perform `op` ion tree itself.
*/
def foreachInThicket(op: Tree[T] => Unit): Unit = op(this)
Expand Down Expand Up @@ -368,7 +361,7 @@ object Trees {
case class This[-T >: Untyped] private[ast] (qual: TypeName)
extends DenotingTree[T] with TermTree[T] {
type ThisTree[-T >: Untyped] = This[T]
// Denotation of a This tree is always the udnerlying class; needs correction for modules.
// Denotation of a This tree is always the underlying class; needs correction for modules.
override def denot(implicit ctx: Context): Denotation = {
tpe match {
case tpe @ TermRef(pre, _) if tpe.symbol is Module =>
Expand Down Expand Up @@ -897,7 +890,7 @@ object Trees {
case tree: BackquotedIdent =>
if (name == tree.name) tree
else finalize(tree, new BackquotedIdent(name))
case tree: Ident if (name == tree.name) => tree
case tree: Ident if name == tree.name => tree
case _ => finalize(tree, untpd.Ident(name))
}
def Select(tree: Tree)(qualifier: Tree, name: Name)(implicit ctx: Context): Select = tree match {
Expand All @@ -908,7 +901,7 @@ object Trees {
case _ => finalize(tree, untpd.Select(qualifier, name))
}
def This(tree: Tree)(qual: TypeName): This = tree match {
case tree: This if (qual == tree.qual) => tree
case tree: This if qual == tree.qual => tree
case _ => finalize(tree, untpd.This(qual))
}
def Super(tree: Tree)(qual: Tree, mix: TypeName): Super = tree match {
Expand All @@ -924,11 +917,11 @@ object Trees {
case _ => finalize(tree, untpd.TypeApply(fun, args))
}
def Literal(tree: Tree)(const: Constant)(implicit ctx: Context): Literal = tree match {
case tree: Literal if (const == tree.const) => tree
case tree: Literal if const == tree.const => tree
case _ => finalize(tree, untpd.Literal(const))
}
def New(tree: Tree)(tpt: Tree)(implicit ctx: Context): New = tree match {
case tree: New if (tpt eq tree.tpt) => tree
case tree: New if tpt eq tree.tpt => tree
case _ => finalize(tree, untpd.New(tpt))
}
def Pair(tree: Tree)(left: Tree, right: Tree)(implicit ctx: Context): Pair = tree match {
Expand Down Expand Up @@ -979,15 +972,15 @@ object Trees {
case tree: JavaSeqLiteral =>
if (elems eq tree.elems) tree
else finalize(tree, new JavaSeqLiteral(elems))
case tree: SeqLiteral if (elems eq tree.elems) => tree
case tree: SeqLiteral if elems eq tree.elems => tree
case _ => finalize(tree, untpd.SeqLiteral(elems))
}
def TypeTree(tree: Tree)(original: Tree): TypeTree = tree match {
case tree: TypeTree if original eq tree.original => tree
case _ => finalize(tree, untpd.TypeTree(original))
}
def SingletonTypeTree(tree: Tree)(ref: Tree): SingletonTypeTree = tree match {
case tree: SingletonTypeTree if (ref eq tree.ref) => tree
case tree: SingletonTypeTree if ref eq tree.ref => tree
case _ => finalize(tree, untpd.SingletonTypeTree(ref))
}
def SelectFromTypeTree(tree: Tree)(qualifier: Tree, name: Name): SelectFromTypeTree = tree match {
Expand All @@ -1011,7 +1004,7 @@ object Trees {
case _ => finalize(tree, untpd.AppliedTypeTree(tpt, args))
}
def ByNameTypeTree(tree: Tree)(result: Tree): ByNameTypeTree = tree match {
case tree: ByNameTypeTree if (result eq tree.result) => tree
case tree: ByNameTypeTree if result eq tree.result => tree
case _ => finalize(tree, untpd.ByNameTypeTree(result))
}
def TypeBoundsTree(tree: Tree)(lo: Tree, hi: Tree): TypeBoundsTree = tree match {
Expand All @@ -1023,7 +1016,7 @@ object Trees {
case _ => finalize(tree, untpd.Bind(name, body))
}
def Alternative(tree: Tree)(trees: List[Tree]): Alternative = tree match {
case tree: Alternative if (trees eq tree.trees) => tree
case tree: Alternative if trees eq tree.trees => tree
case _ => finalize(tree, untpd.Alternative(trees))
}
def UnApply(tree: Tree)(fun: Tree, implicits: List[Tree], patterns: List[Tree]): UnApply = tree match {
Expand Down Expand Up @@ -1059,7 +1052,7 @@ object Trees {
case _ => finalize(tree, untpd.Annotated(annot, arg))
}
def Thicket(tree: Tree)(trees: List[Tree]): Thicket = tree match {
case tree: Thicket if (trees eq tree.trees) => tree
case tree: Thicket if trees eq tree.trees => tree
case _ => finalize(tree, untpd.Thicket(trees))
}

Expand Down
12 changes: 6 additions & 6 deletions src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
override def Select(tree: Tree)(qualifier: Tree, name: Name)(implicit ctx: Context): Select = {
val tree1 = untpd.cpy.Select(tree)(qualifier, name)
tree match {
case tree: Select if (qualifier.tpe eq tree.qualifier.tpe) =>
case tree: Select if qualifier.tpe eq tree.qualifier.tpe =>
tree1.withTypeUnchecked(tree.tpe)
case _ => tree.tpe match {
case tpe: NamedType => tree1.withType(tpe.derivedSelect(qualifier.tpe))
Expand Down Expand Up @@ -504,7 +504,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
override def Block(tree: Tree)(stats: List[Tree], expr: Tree)(implicit ctx: Context): Block = {
val tree1 = untpd.cpy.Block(tree)(stats, expr)
tree match {
case tree: Block if (expr.tpe eq tree.expr.tpe) => tree1.withTypeUnchecked(tree.tpe)
case tree: Block if expr.tpe eq tree.expr.tpe => tree1.withTypeUnchecked(tree.tpe)
case _ => ta.assignType(tree1, stats, expr)
}
}
Expand Down Expand Up @@ -532,7 +532,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
override def CaseDef(tree: Tree)(pat: Tree, guard: Tree, body: Tree)(implicit ctx: Context): CaseDef = {
val tree1 = untpd.cpy.CaseDef(tree)(pat, guard, body)
tree match {
case tree: CaseDef if (body.tpe eq tree.body.tpe) => tree1.withTypeUnchecked(tree.tpe)
case tree: CaseDef if body.tpe eq tree.body.tpe => tree1.withTypeUnchecked(tree.tpe)
case _ => ta.assignType(tree1, body)
}
}
Expand All @@ -543,7 +543,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
override def Try(tree: Tree)(expr: Tree, cases: List[CaseDef], finalizer: Tree)(implicit ctx: Context): Try = {
val tree1 = untpd.cpy.Try(tree)(expr, cases, finalizer)
tree match {
case tree: Try if (expr.tpe eq tree.expr.tpe) && (sameTypes(cases, tree.cases)) => tree1.withTypeUnchecked(tree.tpe)
case tree: Try if (expr.tpe eq tree.expr.tpe) && sameTypes(cases, tree.cases) => tree1.withTypeUnchecked(tree.tpe)
case _ => ta.assignType(tree1, expr, cases)
}
}
Expand Down Expand Up @@ -814,7 +814,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
expectedType match {
case defn.ArrayType(el) =>
lastParam.tpe match {
case defn.ArrayType(el2) if (el2 <:< el) =>
case defn.ArrayType(el2) if el2 <:< el =>
// we have a JavaSeqLiteral with a more precise type
// we cannot construct a tree as JavaSeqLiteral infered to precise type
// if we add typed than it would be both type-correct and
Expand Down Expand Up @@ -865,7 +865,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
}
}

/** A traverser that passes the enlcosing class or method as an argumenr
/** A traverser that passes the enclosing class or method as an argument
* to the traverse method.
*/
abstract class EnclosingMethodTraverser extends TreeAccumulator[Symbol] {
Expand Down
8 changes: 4 additions & 4 deletions src/dotty/tools/dotc/ast/untpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
case _ => new PolyTypeDef(name, tparams, rhs).withPos(tree.pos)
}
def SymbolLit(tree: Tree)(str: String) = tree match {
case tree: SymbolLit if (str == tree.str) => tree
case tree: SymbolLit if str == tree.str => tree
case _ => untpd.SymbolLit(str).withPos(tree.pos)
}
def InterpolatedString(tree: Tree)(id: TermName, strings: List[Literal], elems: List[Tree]) = tree match {
Expand All @@ -298,15 +298,15 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
case _ => untpd.PrefixOp(op, od).withPos(tree.pos)
}
def Parens(tree: Tree)(t: Tree) = tree match {
case tree: Parens if (t eq tree.t) => tree
case tree: Parens if t eq tree.t => tree
case _ => untpd.Parens(t).withPos(tree.pos)
}
def Tuple(tree: Tree)(trees: List[Tree]) = tree match {
case tree: Tuple if (trees eq tree.trees) => tree
case tree: Tuple if trees eq tree.trees => tree
case _ => untpd.Tuple(trees).withPos(tree.pos)
}
def Throw(tree: Tree)(expr: Tree) = tree match {
case tree: Throw if (expr eq tree.expr) => tree
case tree: Throw if expr eq tree.expr => tree
case _ => untpd.Throw(expr).withPos(tree.pos)
}
def WhileDo(tree: Tree)(cond: Tree, body: Tree) = tree match {
Expand Down
4 changes: 2 additions & 2 deletions src/dotty/tools/dotc/config/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object Config {

final val checkCacheMembersNamed = false

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

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