diff options
Diffstat (limited to 'src/dotty/tools/dotc/ast')
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/Trees.scala | 12 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 16 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index 1dfa24291..165f4f535 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -342,9 +342,9 @@ object desugar { val companions = if (mods is Case) { val parent = - if (constrTparams.nonEmpty || - constrVparamss.length > 1 || - mods.is(Abstract) || + if (constrTparams.nonEmpty || + constrVparamss.length > 1 || + mods.is(Abstract) || constr.mods.is(Private)) anyRef // todo: also use anyRef if constructor has a dependent method type (or rule that out)! else (constrVparamss :\ classTypeRef) ((vparams, restpe) => Function(vparams map (_.tpt), restpe)) diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index 1bb0e0f4f..a7f89337c 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -242,9 +242,9 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => * is an abstract typoe declaration */ def lacksDefinition(mdef: MemberDef)(implicit ctx: Context) = mdef match { - case mdef: ValOrDefDef => + case mdef: ValOrDefDef => mdef.unforcedRhs == EmptyTree && !mdef.name.isConstructorName && !mdef.mods.is(ParamAccessor) - case mdef: TypeDef => + case mdef: TypeDef => mdef.rhs.isEmpty || mdef.rhs.isInstanceOf[TypeBoundsTree] case _ => false } diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala index a70869e22..201c29fe1 100644 --- a/src/dotty/tools/dotc/ast/Trees.scala +++ b/src/dotty/tools/dotc/ast/Trees.scala @@ -76,7 +76,7 @@ object Trees { } private var nextId = 0 // for debugging - + type LazyTree = AnyRef /* really: Tree | Lazy[Tree] */ type LazyTreeList = AnyRef /* really: List[Tree] | Lazy[List[Tree]] */ @@ -632,7 +632,7 @@ object Trees { } /** mods def name[tparams](vparams_1)...(vparams_n): tpt = rhs */ - case class DefDef[-T >: Untyped] private[ast] (name: TermName, tparams: List[TypeDef[T]], + case class DefDef[-T >: Untyped] private[ast] (name: TermName, tparams: List[TypeDef[T]], vparamss: List[List[ValDef[T]]], tpt: Tree[T], private var preRhs: LazyTree) extends ValOrDefDef[T] { type ThisTree[-T >: Untyped] = DefDef[T] @@ -761,16 +761,16 @@ object Trees { // ----- Lazy trees and tree sequences - /** A tree that can have a lazy field + /** A tree that can have a lazy field * The field is represented by some private `var` which is * proxied `unforced` and `force`. Forcing the field will - * set the `var` to the underlying value. + * set the `var` to the underlying value. */ trait WithLazyField[+T <: AnyRef] { def unforced: AnyRef protected def force(x: AnyRef): Unit def forceIfLazy(implicit ctx: Context): T = unforced match { - case lzy: Lazy[T] => + case lzy: Lazy[T] => val x = lzy.complete force(x) x @@ -1189,7 +1189,7 @@ object Trees { def apply(x: X, tree: Tree)(implicit ctx: Context): X def apply(x: X, trees: Traversable[Tree])(implicit ctx: Context): X = (x /: trees)(apply) def foldOver(x: X, tree: Tree)(implicit ctx: Context): X = { - def localCtx = + def localCtx = if (tree.hasType && tree.symbol.exists) ctx.withOwner(tree.symbol) else ctx tree match { case Ident(name) => diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index 0f4585a53..20deab372 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -251,8 +251,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def Annotated(annot: Tree, arg: Tree)(implicit ctx: Context): Annotated = ta.assignType(untpd.Annotated(annot, arg), annot, arg) - - def Throw(expr: Tree)(implicit ctx: Context): Tree = + + def Throw(expr: Tree)(implicit ctx: Context): Tree = ref(defn.throwMethod).appliedTo(expr) // ------ Making references ------------------------------------------------------ @@ -409,7 +409,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)) @@ -609,10 +609,10 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { untpd.SelectWithSig(tree, name, sig) .withType(TermRef.withSig(tree.tpe, name.asTermName, sig)) - /** A select node with selector name and signature taken from `sym`. + /** A select node with selector name and signature taken from `sym`. * Note: Use this method instead of select(sym) if the referenced symbol * might be overridden in the type of the qualifier prefix. See note - * on select(sym: Symbol). + * on select(sym: Symbol). */ def selectWithSig(sym: Symbol)(implicit ctx: Context): Tree = selectWithSig(sym.name, sym.signature) @@ -629,7 +629,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def appliedToArgs(args: List[Tree])(implicit ctx: Context): Apply = Apply(tree, args) - /** The current tree applied to given argument lists: + /** The current tree applied to given argument lists: * `tree (argss(0)) ... (argss(argss.length -1))` */ def appliedToArgss(argss: List[List[Tree]])(implicit ctx: Context): Tree = @@ -676,7 +676,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def or(that: Tree)(implicit ctx: Context): Tree = tree.select(defn.Boolean_||).appliedTo(that) - /** The translation of `tree = rhs`. + /** The translation of `tree = rhs`. * This is either the tree as an assignment, to a setter call. */ def becomes(rhs: Tree)(implicit ctx: Context): Tree = @@ -695,7 +695,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { // --- Higher order traversal methods ------------------------------- /** Apply `f` to each subtree of this tree */ - def foreachSubTree(f: Tree => Unit)(implicit ctx: Context): Unit = { + def foreachSubTree(f: Tree => Unit)(implicit ctx: Context): Unit = { val traverser = new TreeTraverser { def traverse(tree: Tree)(implicit ctx: Context) = foldOver(f(tree), tree) } |