diff options
-rw-r--r-- | src/dotty/tools/dotc/ast/Trees.scala | 18 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/UntypedTrees.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/parsing/Parsers.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 2 |
5 files changed, 17 insertions, 17 deletions
diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala index 7e1e70d57..c5fe093d2 100644 --- a/src/dotty/tools/dotc/ast/Trees.scala +++ b/src/dotty/tools/dotc/ast/Trees.scala @@ -37,7 +37,7 @@ object Trees { def pos: Position = curPos /** The envelope containing the item in its entirety. Envelope is different from - * `pos` for definitions (instances of ModDefTree). + * `pos` for definitions (instances of MemberDef). */ def envelope: Position = curPos.toSynthetic @@ -303,18 +303,18 @@ object Trees { } /** Tree defines a new symbol and carries modifiers. - * The position of a ModDefTree contains only the defined identifier or pattern. - * The envelope of a ModDefTree contains the whole definition and his its point + * The position of a MemberDef contains only the defined identifier or pattern. + * The envelope of a MemberDef contains the whole definition and his its point * on the opening keyword (or the next token after that if keyword is missing). */ - trait ModDefTree[T >: Untyped] extends NameTree[T] with DefTree[T] { - type ThisTree[T >: Untyped] <: ModDefTree[T] + trait MemberDef[T >: Untyped] extends NameTree[T] with DefTree[T] { + type ThisTree[T >: Untyped] <: MemberDef[T] def mods: Modifiers[T] override def envelope: Position = mods.pos union pos union initialPos } /** A ValDef or DefDef tree */ - trait ValOrDefDef[T >: Untyped] extends ModDefTree[T] { + trait ValOrDefDef[T >: Untyped] extends MemberDef[T] { def tpt: Tree[T] def rhs: Tree[T] } @@ -572,7 +572,7 @@ object Trees { * mods type name >: lo <: hi, if rhs = TypeBoundsTree(lo, hi) */ case class TypeDef[T >: Untyped](mods: Modifiers[T], name: TypeName, tparams: List[TypeDef[T]], rhs: Tree[T]) - extends ModDefTree[T] { + extends MemberDef[T] { type ThisTree[T >: Untyped] = TypeDef[T] def withName(name: Name) = this.derivedTypeDef(mods, name.toTypeName, tparams, rhs) } @@ -585,7 +585,7 @@ object Trees { /** mods class name[tparams] impl */ case class ClassDef[T >: Untyped](mods: Modifiers[T], name: TypeName, tparams: List[TypeDef[T]], impl: Template[T]) - extends ModDefTree[T] { + extends MemberDef[T] { type ThisTree[T >: Untyped] = ClassDef[T] def withName(name: Name) = this.derivedClassDef(mods, name.toTypeName, tparams, impl) } @@ -687,7 +687,7 @@ object Trees { type NameTree = Trees.NameTree[T] type RefTree = Trees.RefTree[T] type DefTree = Trees.DefTree[T] - type ModDefTree = Trees.ModDefTree[T] + type MemberDef = Trees.MemberDef[T] type ValOrDefDef = Trees.ValOrDefDef[T] type Ident = Trees.Ident[T] diff --git a/src/dotty/tools/dotc/ast/UntypedTrees.scala b/src/dotty/tools/dotc/ast/UntypedTrees.scala index befb5e85c..f0488bedf 100644 --- a/src/dotty/tools/dotc/ast/UntypedTrees.scala +++ b/src/dotty/tools/dotc/ast/UntypedTrees.scala @@ -21,8 +21,8 @@ object untpd extends Trees.Instance[Untyped] { /** mods object name impl */ case class ModuleDef(mods: Modifiers, name: TermName, impl: Template) - extends NameTree with ModDefTree { - type ThisTree[T >: Untyped] <: Trees.NameTree[T] with Trees.ModDefTree[T] with ModuleDef + extends NameTree with MemberDef { + type ThisTree[T >: Untyped] <: Trees.NameTree[T] with Trees.MemberDef[T] with ModuleDef def withName(name: Name) = this.derivedModuleDef(mods, name.toTermName, impl) } diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 9c89a28cf..b585fb0ef 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -498,7 +498,7 @@ object Denotations { if (isType) filterDisjoint(denots).asSeenFrom(pre) else asSeenFrom(pre).filterDisjoint(denots) final def filterExcluded(excluded: FlagSet)(implicit ctx: Context): SingleDenotation = - if (excluded == EmptyFlags) this + if (excluded.isEmpty) this else this match { case thisd: SymDenotation => if (thisd is excluded) NoDenotation else this diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala index 5c585cacb..b6411f7cc 100644 --- a/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/src/dotty/tools/dotc/parsing/Parsers.scala @@ -1301,8 +1301,8 @@ object Parsers { } private def compatible(flags1: FlagSet, flags2: FlagSet): Boolean = ( - flags1 == EmptyFlags - || flags2 == EmptyFlags + flags1.isEmpty + || flags2.isEmpty || flags1.isTermFlags && flags2.isTermFlags || flags1.isTypeFlags && flags2.isTypeFlags ) @@ -1481,7 +1481,7 @@ object Parsers { if (in.token == ARROW) { if (owner.isTypeName && !(mods is Local)) syntaxError(s"${if (mods is Mutable) "`var'" else "`val'"} parameters may not be call-by-name") - else if (implicitFlag != EmptyFlags) + else if (!implicitFlag.isEmpty) syntaxError("implicit parameters may not be call-by-name") } paramType() @@ -1511,7 +1511,7 @@ object Parsers { if (in.token == LPAREN) paramClause() :: { firstClauseOfCaseClass = false - if (implicitFlag == EmptyFlags) clauses() else Nil + if (implicitFlag.isEmpty) clauses() else Nil } else Nil } diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index e0a65bb52..45f788e15 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -120,7 +120,7 @@ abstract class Namer { typer: Typer => sym } tree match { - case tree: ModDefTree => + case tree: MemberDef => val sym = createSym(tree.name, tree.mods.flags, privateWithinClass(tree.mods)) ctx.enterSym(sym) sym |