summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/attic/scala/tools/nsc/models/Models.scala2
-rw-r--r--src/attic/scala/tools/nsc/models/SemanticTokens.scala8
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala7
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/DocComments.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/NodePrinters.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeInfo.scala6
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreePrinters.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala48
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Members.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Printers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala7
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala43
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala12
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala2
-rw-r--r--src/compiler/scala/tools/nsc/dependencies/DependencyAnalysis.scala4
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala12
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala6
-rw-r--r--src/compiler/scala/tools/nsc/javac/JavaParsers.scala6
-rw-r--r--src/compiler/scala/tools/nsc/matching/ParallelMatching.scala2
-rw-r--r--src/compiler/scala/tools/nsc/matching/Patterns.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala36
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala18
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala33
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala12
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala6
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala15
-rw-r--r--src/compiler/scala/tools/nsc/transform/Flatten.scala4
-rw-r--r--src/compiler/scala/tools/nsc/transform/LazyVals.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala64
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala10
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala8
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala15
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala68
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala8
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala20
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala115
-rw-r--r--src/library/scala/reflect/generic/HasFlags.scala8
-rwxr-xr-xsrc/library/scala/reflect/generic/Symbols.scala1
53 files changed, 333 insertions, 341 deletions
diff --git a/src/attic/scala/tools/nsc/models/Models.scala b/src/attic/scala/tools/nsc/models/Models.scala
index 7365709b25..e30b8bac02 100644
--- a/src/attic/scala/tools/nsc/models/Models.scala
+++ b/src/attic/scala/tools/nsc/models/Models.scala
@@ -84,7 +84,7 @@ abstract class Models {
}
} else {
val ddef = tree.asInstanceOf[ValOrDefDef];
- if (ddef.mods.hasFlag(symtab.Flags.MUTABLE)) VAR;
+ if (ddef.mods.isMutable) VAR;
else VAL;
}
}
diff --git a/src/attic/scala/tools/nsc/models/SemanticTokens.scala b/src/attic/scala/tools/nsc/models/SemanticTokens.scala
index ab75bbbcfc..badbcecd77 100644
--- a/src/attic/scala/tools/nsc/models/SemanticTokens.scala
+++ b/src/attic/scala/tools/nsc/models/SemanticTokens.scala
@@ -234,7 +234,7 @@ class SemanticTokens(val compiler: Global) {
build(tree.impl.parents)
build(tree.impl.body)
case tree: ValOrDefDef =>
- if (!tree.symbol.hasFlag(Flags.ACCESSOR) || tree.symbol.hasFlag(DEFERRED)) {
+ if (!tree.symbol.hasAccessorFlag || tree.symbol.isDeferred) {
// MO: I added !tree.symbol.hasFlag(DEFERRED) in a refactoring where
// getters now can be abstract whereas before they could not.
// Adding the condition thus keeps the old behavior.
@@ -244,9 +244,9 @@ class SemanticTokens(val compiler: Global) {
eatKeywords(unit.source.asInstanceOf[BatchSourceFile], tree.pos.point);
if (false) Console.err.println("VALDEF: tree=" + tree + " sym=" + tree.symbol + " pos0=" +
tree.symbol.pos + " alias=" + tree.symbol.alias + " pos1=" +
- pos + " pos2=" + tree.pos.dbgString + " " + tree.symbol.hasFlag(Flags.SYNTHETIC));
+ pos + " pos2=" + tree.pos.dbgString + " " + tree.symbol.isSynthetic);
- if (pos != -1 && !tree.hasFlag(Flags.SYNTHETIC))
+ if (pos != -1 && !tree.isSynthetic)
buildDef(tree.symbol, pos);
}
@@ -496,7 +496,7 @@ class SemanticTokens(val compiler: Global) {
def buildDef(term: Symbol, pos: Int) = buildSym(term, pos, true, null)
def buildSym(term: Symbol, pos: Int, isDef: Boolean, tpe: Type): Unit =
- if (term.hasFlag(Flags.ACCESSOR))
+ if (term.hasAccessorFlag)
buildSym(analyzer.underlying(term), pos, isDef, tpe)
else if (pos == -1) {
//Console.err.println("NOPOS: " + term)
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 2f9b63eead..12fbad6adb 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -959,7 +959,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
private def writeICode() {
val printer = new icodes.TextPrinter(null, icodes.linearizer)
icodes.classes.values.foreach((cls) => {
- val suffix = if (cls.symbol hasFlag Flags.MODULE) "$.icode" else ".icode"
+ val suffix = if (cls.symbol.hasModuleFlag) "$.icode" else ".icode"
var file = getFile(cls.symbol, suffix)
// if (file.exists())
// file = new File(file.getParentFile(), file.getName() + "1")
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index a28bb7d17d..17f543f8e3 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -674,7 +674,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
}
def boundNames: List[Name] = Nil
val definesImplicit = cond(member) {
- case tree: MemberDef => tree.mods hasFlag Flags.IMPLICIT
+ case tree: MemberDef => tree.mods.isImplicit
}
def generatesValue: Option[Name] = None
@@ -690,7 +690,6 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
val maxStringElements = 1000 // no need to mkString billions of elements
lazy val ValDef(mods, vname, _, _) = member
lazy val prettyName = NameTransformer.decode(vname)
- lazy val isLazy = mods hasFlag Flags.LAZY
override lazy val boundNames = List(vname)
override def generatesValue = Some(vname)
@@ -702,7 +701,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
lazy val extractor = "scala.runtime.ScalaRunTime.stringOf(%s, %s)".format(req fullPath vname, maxStringElements)
// if this is a lazy val we avoid evaluating it here
- val resultString = if (isLazy) codegenln(false, "<lazy>") else extractor
+ val resultString = if (mods.isLazy) codegenln(false, "<lazy>") else extractor
val codeToPrint =
""" + "%s: %s = " + %s""".format(prettyName, string2code(req typeOf vname), resultString)
@@ -752,7 +751,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
private class ClassHandler(classdef: ClassDef) extends MemberHandler(classdef) {
lazy val ClassDef(mods, name, _, _) = classdef
override lazy val boundNames =
- name :: (if (mods hasFlag Flags.CASE) List(name.toTermName) else Nil)
+ name :: (if (mods.isCase) List(name.toTermName) else Nil)
override def resultExtractionCode(req: Request, code: PrintWriter) =
code print codegenln("defined %s %s".format(classdef.keyword, name))
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala
index 79ac89e360..01ab14ae9f 100755
--- a/src/compiler/scala/tools/nsc/ast/DocComments.scala
+++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala
@@ -65,7 +65,7 @@ trait DocComments { self: SymbolTable =>
*/
def expandedDocComment(sym: Symbol, site: Symbol, docStr: String = ""): String = {
// when parsing a top level class or module, use the (module-)class itself to look up variable definitions
- val site1 = if ((sym.isModule || sym.isClass) && (site hasFlag Flags.PACKAGE)) sym
+ val site1 = if ((sym.isModule || sym.isClass) && site.hasPackageFlag) sym
else site
expandVariables(cookedDocComment(sym, docStr), sym, site1)
}
diff --git a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala
index 458b87fde4..37c87633e2 100644
--- a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala
+++ b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala
@@ -145,7 +145,7 @@ abstract class NodePrinters {
if ((infolevel > InfoLevel.Normal) &&
!(sym.owner eq definitions.ScalaPackageClass) &&
!sym.isModuleClass && !sym.isPackageClass &&
- !sym.hasFlag(JAVA)) {
+ !sym.isJavaDefined) {
val members = for (m <- tree.tpe.decls.toList)
yield m.toString() + ": " + m.tpe + ", "
buf.append(", tpe.decls=" + members)
diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
index a315a81bab..4ca3849553 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
@@ -48,8 +48,8 @@ abstract class TreeInfo {
case EmptyTree => true
case Import(_, _) => true
case TypeDef(_, _, _, _) => true
- case DefDef(mods, _, _, _, _, __) => mods.hasFlag(DEFERRED)
- case ValDef(mods, _, _, _) => mods.hasFlag(DEFERRED)
+ case DefDef(mods, _, _, _, _, __) => mods.isDeferred
+ case ValDef(mods, _, _, _) => mods.isDeferred
case DocDef(_, definition) => isInterfaceMember(definition)
case _ => false
}
@@ -64,7 +64,7 @@ abstract class TreeInfo {
| DefDef(_, _, _, _, _, _) =>
true
case ValDef(mods, _, _, rhs) =>
- !mods.hasFlag(MUTABLE) && isPureExpr(rhs)
+ !mods.isMutable && isPureExpr(rhs)
case DocDef(_, definition) =>
isPureDef(definition)
case _ =>
diff --git a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
index 19a7ebbe44..9f2b8b4cbd 100644
--- a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
@@ -154,7 +154,7 @@ trait TreePrinters { trees: SymbolTable =>
printAnnotations(tree)
printModifiers(tree, mods)
val word =
- if (mods.isTrait) "trait"
+ if (mods.hasTraitFlag) "trait"
else if (ifSym(tree, _.isModuleClass)) "object"
else "class"
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 1732bb73a3..b3aaf02195 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -10,7 +10,7 @@ package ast.parser
import scala.collection.mutable.ListBuffer
import util.{ OffsetPosition }
-import symtab.Flags
+import scala.reflect.generic.{ ModifierFlags => Flags }
import Tokens._
//todo verify when stableId's should be just plain qualified type ids
@@ -1677,12 +1677,12 @@ self =>
/* -------- MODIFIERS and ANNOTATIONS ------------------------------------------- */
/** Drop `private' modifier when followed by a qualifier.
- * Conract `abstract' and `override' to ABSOVERRIDE
+ * Contract `abstract' and `override' to ABSOVERRIDE
*/
private def normalize(mods: Modifiers): Modifiers =
- if ((mods hasFlag Flags.PRIVATE) && mods.privateWithin != nme.EMPTY.toTypeName)
+ if (mods.isPrivate && mods.hasAccessBoundary)
normalize(mods &~ Flags.PRIVATE)
- else if ((mods hasFlag Flags.ABSTRACT) && (mods hasFlag Flags.OVERRIDE))
+ else if (mods hasAllFlags (Flags.ABSTRACT | Flags.OVERRIDE))
normalize(mods &~ (Flags.ABSTRACT | Flags.OVERRIDE) | Flags.ABSOVERRIDE)
else
mods
@@ -1701,7 +1701,7 @@ self =>
var result = mods
if (in.token == LBRACKET) {
in.nextToken()
- if (mods.privateWithin != nme.EMPTY.toTypeName)
+ if (mods.hasAccessBoundary)
syntaxError("duplicate private/protected qualifier", false)
result = if (in.token == THIS) { in.nextToken(); mods | Flags.LOCAL }
else Modifiers(mods.flags, ident().toTypeName)
@@ -1819,7 +1819,7 @@ self =>
var mods = Modifiers(Flags.PARAM)
if (owner.isTypeName) {
mods = modifiers() | Flags.PARAMACCESSOR
- if (mods.hasFlag(Flags.LAZY)) syntaxError("lazy modifier not allowed here. Use call-by-name parameters instead", false)
+ if (mods.isLazy) syntaxError("lazy modifier not allowed here. Use call-by-name parameters instead", false)
if (in.token == VAL) {
mods = mods withPosition (in.token, tokenRange(in))
in.nextToken()
@@ -1846,10 +1846,10 @@ self =>
} else { // XX-METHOD-INFER
accept(COLON)
if (in.token == ARROW) {
- if (owner.isTypeName && !mods.hasFlag(Flags.LOCAL))
+ if (owner.isTypeName && !mods.hasLocalFlag)
syntaxError(
in.offset,
- (if (mods.hasFlag(Flags.MUTABLE)) "`var'" else "`val'") +
+ (if (mods.isMutable) "`var'" else "`val'") +
" parameters may not be call-by-name", false)
else if (implicitmod != 0)
syntaxError(
@@ -1901,7 +1901,7 @@ self =>
val result = vds.toList
if (owner == nme.CONSTRUCTOR &&
(result.isEmpty ||
- (!result.head.isEmpty && result.head.head.mods.hasFlag(Flags.IMPLICIT))))
+ (!result.head.isEmpty && result.head.head.mods.isImplicit)))
if (in.token == LBRACKET)
syntaxError(in.offset, "no type parameters allowed here", false)
else if(in.token == EOF)
@@ -2123,7 +2123,7 @@ self =>
* | type [nl] TypeDcl
*/
def defOrDcl(pos: Int, mods: Modifiers): List[Tree] = {
- if ((mods hasFlag Flags.LAZY) && in.token != VAL)
+ if (mods.isLazy && in.token != VAL)
syntaxError("lazy not allowed here. Only vals can be lazy", false)
in.token match {
case VAL =>
@@ -2163,7 +2163,7 @@ self =>
val rhs =
if (tp.isEmpty || in.token == EQUALS) {
accept(EQUALS)
- if (!tp.isEmpty && newmods.hasFlag(Flags.MUTABLE) &&
+ if (!tp.isEmpty && newmods.isMutable &&
(lhs.toList forall (_.isInstanceOf[Ident])) && in.token == USCORE) {
in.nextToken()
newmods = newmods | Flags.DEFAULTINIT
@@ -2182,10 +2182,10 @@ self =>
if (tp.isEmpty) p
else Typed(p, tp) setPos (p.pos union tp.pos),
rhs)
- if (newmods hasFlag Flags.DEFERRED) {
+ if (newmods.isDeferred) {
trees match {
case List(ValDef(_, _, _, EmptyTree)) =>
- if (mods.hasFlag(Flags.LAZY)) syntaxError(p.pos, "lazy values may not be abstract", false)
+ if (mods.isLazy) syntaxError(p.pos, "lazy values may not be abstract", false)
case _ => syntaxError(p.pos, "pattern definition may not be abstract", false)
}
}
@@ -2349,7 +2349,7 @@ self =>
* | [override] trait TraitDef
*/
def tmplDef(pos: Int, mods: Modifiers): Tree = {
- if (mods.hasFlag(Flags.LAZY)) syntaxError("classes cannot be lazy", false)
+ if (mods.isLazy) syntaxError("classes cannot be lazy", false)
in.token match {
case TRAIT =>
classDef(pos, (mods | Flags.TRAIT | Flags.ABSTRACT) withPosition (Flags.TRAIT, tokenRange(in)))
@@ -2381,16 +2381,16 @@ self =>
val tparams = typeParamClauseOpt(name, contextBoundBuf)
classContextBounds = contextBoundBuf.toList
val tstart = (in.offset::classContextBounds.map(_.pos.startOrPoint)).min
- if (!classContextBounds.isEmpty && mods.hasFlag(Flags.TRAIT)) {
+ if (!classContextBounds.isEmpty && mods.hasTraitFlag) {
syntaxError("traits cannot have type parameters with context bounds `: ...' nor view bounds `<% ...'", false)
classContextBounds = List()
}
val constrAnnots = annotations(false, true)
val (constrMods, vparamss) =
- if (mods.hasFlag(Flags.TRAIT)) (Modifiers(Flags.TRAIT), List())
- else (accessModifierOpt(), paramClauses(name, classContextBounds, mods.hasFlag(Flags.CASE)))
+ if (mods.hasTraitFlag) (Modifiers(Flags.TRAIT), List())
+ else (accessModifierOpt(), paramClauses(name, classContextBounds, mods.isCase))
var mods1 = mods
- if (mods hasFlag Flags.TRAIT) {
+ if (mods.hasTraitFlag) {
if (settings.YvirtClasses && in.token == SUBTYPE) mods1 |= Flags.DEFERRED
} else if (in.token == SUBTYPE) {
syntaxError("classes are not allowed to be virtual", false)
@@ -2449,7 +2449,7 @@ self =>
val (self, body) = templateBody(true)
if (in.token == WITH && self.isEmpty) {
val earlyDefs: List[Tree] = body flatMap {
- case vdef @ ValDef(mods, name, tpt, rhs) if !(mods hasFlag Flags.DEFERRED) =>
+ case vdef @ ValDef(mods, name, tpt, rhs) if !mods.isDeferred =>
List(treeCopy.ValDef(vdef, mods | Flags.PRESUPER, name, tpt, rhs))
case tdef @ TypeDef(mods, name, tparams, rhs) =>
List(treeCopy.TypeDef(tdef, mods | Flags.PRESUPER, name, tparams, rhs))
@@ -2473,7 +2473,7 @@ self =>
}
def isInterface(mods: Modifiers, body: List[Tree]): Boolean =
- (mods hasFlag Flags.TRAIT) && (body forall treeInfo.isInterfaceMember)
+ mods.hasTraitFlag && (body forall treeInfo.isInterfaceMember)
/** ClassTemplateOpt ::= 'extends' ClassTemplate | [['extends'] TemplateBody]
* TraitTemplateOpt ::= TraitExtends TraitTemplate | [['extends'] TemplateBody] | '<:' TemplateBody
@@ -2482,10 +2482,10 @@ self =>
def templateOpt(mods: Modifiers, name: Name, constrMods: Modifiers,
vparamss: List[List[ValDef]], tstart: Int): Template = {
val (parents0, argss, self, body) =
- if (in.token == EXTENDS || settings.YvirtClasses && (mods hasFlag Flags.TRAIT) && in.token == SUBTYPE) {
+ if (in.token == EXTENDS || settings.YvirtClasses && mods.hasTraitFlag && in.token == SUBTYPE) {
in.nextToken()
- template(mods hasFlag Flags.TRAIT)
- } else if ((in.token == SUBTYPE) && (mods hasFlag Flags.TRAIT)) {
+ template(mods.hasTraitFlag)
+ } else if ((in.token == SUBTYPE) && mods.hasTraitFlag) {
in.nextToken()
template(true)
} else {
@@ -2498,7 +2498,7 @@ self =>
parents = parents ::: List(scalaScalaObjectConstr)
if (parents.isEmpty)
parents = List(scalaAnyRefConstr)
- if (mods.hasFlag(Flags.CASE)) parents = parents ::: List(productConstr)
+ if (mods.isCase) parents = parents ::: List(productConstr)
val tstart0 = if (body.isEmpty && in.lastOffset < tstart) in.lastOffset else tstart
atPos(tstart0) {
Template(parents, self, constrMods, vparamss, argss, body, o2p(tstart))
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index cd10434b3a..432640c37d 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -121,7 +121,7 @@ abstract class GenICode extends SubComponent {
addMethodParams(ctx1, vparamss)
m.native = m.symbol.hasAnnotation(definitions.NativeAttr)
- if (!m.isDeferred && !m.native) {
+ if (!m.isAbstractMethod && !m.native) {
ctx1 = genLoad(rhs, ctx1, m.returnType);
// reverse the order of the local variables, to match the source-order
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala
index 53205e26ca..78862a90cb 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala
@@ -120,7 +120,7 @@ abstract class ICodeCheckers {
def check(m: IMethod) {
logChecker("\n** Checking method " + m)
method = m
- if (!m.isDeferred)
+ if (!m.isAbstractMethod)
check(m.code)
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
index 8001c30efd..6392131e58 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
@@ -190,10 +190,8 @@ trait Members { self: ICodes =>
def addHandler(e: ExceptionHandler) = exh ::= e
/** Is this method deferred ('abstract' in Java sense)?
- * This differs from sym.isDeferred because the symbol only examines the
- * flag, which may not be set in the other covered cases.
*/
- def isDeferred = (symbol hasFlag DEFERRED) || symbol.owner.isInterface || native
+ def isAbstractMethod = symbol.isDeferred || symbol.owner.isInterface || native
def isStatic: Boolean = symbol.isStaticMember
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
index 7b76183c58..4fbec28fdf 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
@@ -81,7 +81,7 @@ trait Printers { self: ICodes =>
print("("); printList(printParam)(m.params, ", "); print(")");
print(": "); print(m.symbol.info.resultType)
- if (!m.isDeferred) {
+ if (!m.isAbstractMethod) {
println(" {")
println("locals: " + m.locals.mkString("", ", ", ""))
println("startBlock: " + m.code.startBlock)
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
index 1c484c7d8e..b026921ca6 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
@@ -7,8 +7,7 @@
package scala.tools.nsc
package backend.icode.analysis
-import scala.collection.mutable.{Map, HashMap}
-import scala.tools.nsc.symtab.Flags.DEFERRED
+import scala.collection.mutable.{ Map, HashMap }
/** A modified copy-propagation like analysis. It
* is augmented with a record-like value which is used
@@ -508,9 +507,9 @@ abstract class CopyPropagation {
*/
final def invalidateRecords(state: copyLattice.State) {
def shouldRetain(sym: Symbol): Boolean = {
- if (sym.hasFlag(symtab.Flags.MUTABLE))
+ if (sym.isMutable)
log("dropping binding for " + sym.fullName)
- !sym.hasFlag(symtab.Flags.MUTABLE)
+ !sym.isMutable
}
state.stack = state.stack map { v => v match {
case Record(cls, bindings) =>
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index 230dea2f3b..60c186cb27 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -68,8 +68,8 @@ abstract class GenJVM extends SubComponent {
/** Return the suffix of a class name */
def moduleSuffix(sym: Symbol) =
- if (sym.hasFlag(Flags.MODULE) && !sym.isMethod &&
- !sym.isImplClass && !sym.hasFlag(Flags.JAVA)) "$"
+ if (sym.hasModuleFlag && !sym.isMethod &&
+ !sym.isImplClass && !sym.isJavaDefined) "$"
else "";
@@ -260,12 +260,12 @@ abstract class GenJVM extends SubComponent {
// it must be a top level class (name contains no $s)
def isCandidateForForwarders(sym: Symbol): Boolean =
atPhase (currentRun.picklerPhase.next) {
- !(sym.name.toString contains '$') && (sym hasFlag Flags.MODULE) && !sym.isImplClass && !sym.isNestedClass
+ !(sym.name.toString contains '$') && sym.hasModuleFlag && !sym.isImplClass && !sym.isNestedClass
}
val lmoc = c.symbol.companionModule
// add static forwarders if there are no name conflicts; see bugs #363 and #1735
- if (lmoc != NoSymbol && !c.symbol.hasFlag(Flags.INTERFACE)) {
+ if (lmoc != NoSymbol && !c.symbol.isInterface) {
if (isCandidateForForwarders(lmoc) && !settings.noForwarders.value) {
log("Adding static forwarders from '%s' to implementations in '%s'".format(c.symbol, lmoc))
addForwarders(jclass, lmoc.moduleClass)
@@ -394,7 +394,7 @@ abstract class GenJVM extends SubComponent {
* .initialize: if 'annot' is read from pickle, atp might be un-initialized
*/
private def shouldEmitAnnotation(annot: AnnotationInfo) =
- (annot.atp.typeSymbol.initialize.hasFlag(Flags.JAVA) &&
+ (annot.atp.typeSymbol.initialize.isJavaDefined &&
annot.atp.typeSymbol.isNonBottomSubClass(ClassfileAnnotationClass) &&
annot.args.isEmpty)
@@ -491,10 +491,16 @@ abstract class GenJVM extends SubComponent {
nannots
}
+ private def noGenericSignature(sym: Symbol) = (
+ sym.isSynthetic ||
+ sym.isLiftedMethod ||
+ (sym hasFlag Flags.EXPANDEDNAME) ||
+ // @M don't generate java generics sigs for (members of) implementation classes, as they are monomorphic (TODO: ok?)
+ (sym.ownerChain exists (_.isImplClass))
+ )
def addGenericSignature(jmember: JMember, sym: Symbol, owner: Symbol) {
- if (!sym.hasFlag(Flags.EXPANDEDNAME | Flags.SYNTHETIC)
- && !(sym.isMethod && sym.hasFlag(Flags.LIFTED))
- && !(sym.ownerChain exists (_.isImplClass))) { // @M don't generate java generics sigs for (members of) implementation classes, as they are monomorphic (TODO: ok?)
+ if (noGenericSignature(sym)) ()
+ else {
val memberTpe = atPhase(currentRun.erasurePhase)(owner.thisType.memberInfo(sym))
// println("addGenericSignature sym: " + sym.fullName + " : " + memberTpe + " sym.info: " + sym.info)
// println("addGenericSignature: "+ (sym.ownerChain map (x => (x.name, x.isImplClass))))
@@ -576,7 +582,7 @@ abstract class GenJVM extends SubComponent {
if (outerName.endsWith("$") && isTopLevelModule(innerSym.rawowner))
outerName = outerName dropRight 1
var flags = javaFlags(innerSym)
- if (innerSym.rawowner.hasFlag(Flags.MODULE))
+ if (innerSym.rawowner.hasModuleFlag)
flags |= ACC_STATIC
innerClassesAttr.addEntry(javaName(innerSym),
@@ -593,7 +599,7 @@ abstract class GenJVM extends SubComponent {
}
def isStaticModule(sym: Symbol): Boolean = {
- sym.isModuleClass && !sym.isImplClass && !sym.hasFlag(Flags.LIFTED)
+ sym.isModuleClass && !sym.isImplClass && !sym.isLifted
}
def genField(f: IField) {
@@ -722,7 +728,7 @@ abstract class GenJVM extends SubComponent {
private def isClosureApply(sym: Symbol): Boolean = {
(sym.name == nme.apply) &&
- sym.owner.hasFlag(Flags.SYNTHETIC) &&
+ sym.owner.isSynthetic &&
sym.owner.tpe.parents.exists { t =>
val TypeRef(_, sym, _) = t;
FunctionClass contains sym
@@ -883,7 +889,7 @@ abstract class GenJVM extends SubComponent {
addRemoteException(mirrorMethod, m)
// only add generic signature if the method is concrete; bug #1745
- if (!m.hasFlag(Flags.DEFERRED))
+ if (!m.isDeferred)
addGenericSignature(mirrorMethod, m, module)
val (throws, others) = splitAnnotations(m.annotations, ThrowsClass)
@@ -1125,7 +1131,6 @@ abstract class GenJVM extends SubComponent {
case LOAD_FIELD(field, isStatic) =>
var owner = javaName(field.owner)
-// if (field.owner.hasFlag(Flags.MODULE)) owner = owner + "$";
if (settings.debug.value)
log("LOAD_FIELD with owner: " + owner +
" flags: " + Flags.flagsToString(field.owner.flags))
@@ -1162,7 +1167,7 @@ abstract class GenJVM extends SubComponent {
jcode.emitASTORE_0()
case STORE_FIELD(field, isStatic) =>
- val owner = javaName(field.owner) // + (if (field.owner.hasFlag(Flags.MODULE)) "$" else "");
+ val owner = javaName(field.owner)
if (isStatic)
jcode.emitPUTSTATIC(owner,
javaName(field),
@@ -1648,8 +1653,7 @@ abstract class GenJVM extends SubComponent {
* Synthetic locals are skipped. All variables are method-scoped.
*/
private def genLocalVariableTable(m: IMethod, jcode: JCode) {
- var vars = m.locals.filter(l => !l.sym.hasFlag(Flags.SYNTHETIC))
-
+ var vars = m.locals filterNot (_.sym.isSynthetic)
if (vars.length == 0) return
val pool = jclass.getConstantPool()
@@ -1839,7 +1843,7 @@ abstract class GenJVM extends SubComponent {
mkFlags(
if (isConsideredPrivate) ACC_PRIVATE else ACC_PUBLIC,
- if (sym.isDeferred || sym.hasFlag(Flags.ABSTRACT)) ACC_ABSTRACT else 0,
+ if (sym.isDeferred || sym.hasAbstractFlag) ACC_ABSTRACT else 0,
if (sym.isInterface) ACC_INTERFACE else 0,
if (sym.isFinal && !sym.enclClass.isInterface && !sym.isClassConstructor) ACC_FINAL else 0,
if (sym.isStaticMember) ACC_STATIC else 0,
@@ -1858,9 +1862,8 @@ abstract class GenJVM extends SubComponent {
if (sym.isTrait) sym.info // needed so that the type is up to date
// (erasure may add lateINTERFACE to traits)
- sym.hasFlag(Flags.INTERFACE) ||
- (sym.hasFlag(Flags.JAVA) &&
- sym.isNonBottomSubClass(ClassfileAnnotationClass))
+ sym.isInterface ||
+ (sym.isJavaDefined && sym.isNonBottomSubClass(ClassfileAnnotationClass))
}
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index 87c9b929b5..ad60524485 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -307,7 +307,7 @@ abstract class GenMSIL extends SubComponent {
log("creating annotations: " + annotations + " for member : " + member)
for (annot@ AnnotationInfo(typ, annArgs, nvPairs) <- annotations ;
if annot.isConstant)
- //!typ.typeSymbol.hasFlag(Flags.JAVA)
+ //!typ.typeSymbol.isJavaDefined
{
// assert(consts.length <= 1,
// "too many constant arguments for annotations; "+consts.toString())
@@ -1629,9 +1629,9 @@ abstract class GenMSIL extends SubComponent {
* not exist in the classpath: the type checker will be very confused.
*/
def msilName(sym: Symbol): String = {
- val suffix: String = if (sym.hasFlag(Flags.MODULE) && !sym.isMethod &&
+ val suffix: String = if (sym.hasModuleFlag && !sym.isMethod &&
!sym.isImplClass &&
- !sym.hasFlag(Flags.JAVA)) "$" else ""
+ !sym.isJavaDefined) "$" else ""
// Flags.JAVA: "symbol was not defined by a scala-class" (java, or .net-class)
if (sym == definitions.NothingClass)
@@ -1688,7 +1688,7 @@ abstract class GenMSIL extends SubComponent {
mf = mf | MethodAttributes.Virtual
if (sym.isFinal && !getType(sym.owner).IsInterface)
mf = mf | MethodAttributes.Final
- if (sym.hasFlag(Flags.DEFERRED) || getType(sym.owner).IsInterface)
+ if (sym.isDeferred || getType(sym.owner).IsInterface)
mf = mf | MethodAttributes.Abstract
}
}
@@ -2049,8 +2049,8 @@ abstract class GenMSIL extends SubComponent {
val iclass = classes(sym)
for (m <- sym.tpe.nonPrivateMembers
- if m.owner != definitions.ObjectClass && !m.hasFlag(Flags.PROTECTED) &&
- m.isMethod && !m.isClassConstructor && !m.isStaticMember && !m.hasFlag(Flags.CASE))
+ if m.owner != definitions.ObjectClass && !m.isProtected &&
+ m.isMethod && !m.isClassConstructor && !m.isStaticMember && !m.isCase)
{
if (settings.debug.value)
log(" Mirroring method: " + m)
diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
index 224893d60b..43eebcb0ad 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
@@ -274,7 +274,7 @@ abstract class DeadCodeElimination extends SubComponent {
lazy val RuntimePackage = definitions.getModule("scala.runtime")
/** Is 'sym' a side-effecting method? TODO: proper analysis. */
private def isSideEffecting(sym: Symbol): Boolean = {
- !((sym.isGetter && !sym.hasFlag(Flags.LAZY))
+ !((sym.isGetter && !sym.isLazy)
|| (sym.isConstructor
&& !(sym.owner == method.symbol.owner && method.symbol.isConstructor) // a call to another constructor
&& sym.owner.owner == RuntimePackage.moduleClass)
diff --git a/src/compiler/scala/tools/nsc/dependencies/DependencyAnalysis.scala b/src/compiler/scala/tools/nsc/dependencies/DependencyAnalysis.scala
index aa784e9c87..30acdff594 100644
--- a/src/compiler/scala/tools/nsc/dependencies/DependencyAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/dependencies/DependencyAnalysis.scala
@@ -157,7 +157,7 @@ trait DependencyAnalysis extends SubComponent with Files {
if ((tree.symbol ne null)
&& (tree.symbol != NoSymbol)
&& (!tree.symbol.isPackage)
- && (!tree.symbol.hasFlag(Flags.JAVA))
+ && (!tree.symbol.isJavaDefined)
&& ((tree.symbol.sourceFile eq null)
|| (tree.symbol.sourceFile.path != file.path))
&& (!tree.symbol.isClassConstructor)) {
@@ -168,7 +168,7 @@ trait DependencyAnalysis extends SubComponent with Files {
}
tree match {
- case cdef: ClassDef if !cdef.symbol.hasFlag(Flags.PACKAGE) &&
+ case cdef: ClassDef if !cdef.symbol.hasPackageFlag &&
!cdef.symbol.isAnonymousFunction =>
if (cdef.symbol != NoSymbol) buf += cdef.symbol
atPhase(currentRun.erasurePhase.prev) {
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
index 55e9ec0b89..569b0d2a30 100644
--- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -70,7 +70,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
def isTrait = sym.isTrait
def isClass = sym.isClass && !sym.isTrait
def isObject = sym.isModule && !sym.isPackage
- def isCaseClass = sym.isClass && sym.hasFlag(Flags.CASE)
+ def isCaseClass = sym.isCaseClass
def isRootPackage = false
def selfType = if (sym.thisSym eq sym) None else Some(makeType(sym.thisSym.typeOfThis, this))
}
@@ -98,7 +98,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
else if (sym.isProtectedLocal) ProtectedInInstance()
else {
val qual =
- if (sym.privateWithin != null && sym.privateWithin != NoSymbol)
+ if (sym.hasAccessBoundary)
Some(makeTemplate(sym.privateWithin))
else None
if (sym.isPrivate) PrivateInTemplate(inTpl)
@@ -110,7 +110,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
def flags = {
val fgs = mutable.ListBuffer.empty[Paragraph]
if (sym.isImplicit) fgs += Paragraph(Text("implicit"))
- if (sym hasFlag Flags.SEALED) fgs += Paragraph(Text("sealed"))
+ if (sym.isSealed) fgs += Paragraph(Text("sealed"))
if (!sym.isTrait && (sym hasFlag Flags.ABSTRACT)) fgs += Paragraph(Text("abstract"))
if (!sym.isTrait && (sym hasFlag Flags.DEFERRED)) fgs += Paragraph(Text("abstract"))
if (!sym.isModule && (sym hasFlag Flags.FINAL)) fgs += Paragraph(Text("final"))
@@ -392,7 +392,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
Some(new NonTemplateMemberImpl(bSym, inTpl) with Val {
override def isVar = true
})
- else if (bSym.isMethod && !bSym.isGetterOrSetter && !bSym.isConstructor && !bSym.isModule)
+ else if (bSym.isMethod && !bSym.hasAccessorFlag && !bSym.isConstructor && !bSym.isModule)
Some(new NonTemplateParamMemberImpl(bSym, inTpl) with HigherKindedImpl with Def {
override def isDef = true
})
@@ -572,12 +572,12 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
}
def isNestedObjectLazyVal(aSym: Symbol): Boolean = {
- aSym.isLazy && !aSym.isRootPackage && !aSym.owner.isPackageClass && (aSym.lazyAccessor != NoSymbol)
+ aSym.isLazyAccessor && !aSym.isRootPackage && !aSym.owner.isPackageClass
}
def isEmptyJavaObject(aSym: Symbol): Boolean = {
def hasMembers = aSym.info.members.exists(s => localShouldDocument(s) && (!s.isConstructor || s.owner == aSym))
- aSym.isModule && aSym.hasFlag(Flags.JAVA) && !hasMembers
+ aSym.isModule && aSym.isJavaDefined && !hasMembers
}
def localShouldDocument(aSym: Symbol): Boolean = {
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index dedd79f634..7cd225b719 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -444,7 +444,7 @@ self =>
val locals = new LinkedHashMap[Name, ScopeMember]
def addScopeMember(sym: Symbol, pre: Type, viaImport: Tree) =
if (!sym.name.decode.containsName(Dollar) &&
- !sym.hasFlag(Flags.SYNTHETIC) &&
+ !sym.isSynthetic &&
!locals.contains(sym.name)) {
locals(sym.name) = new ScopeMember(
sym,
diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
index bde90bc347..64b57bcbf3 100644
--- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
+++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
@@ -106,8 +106,8 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
// See if we really have corresponding symbols, not just those
// which share the name
def isCorrespondingSym(from: Symbol, to: Symbol): Boolean =
- (from.hasFlag(Flags.TRAIT) == to.hasFlag(Flags.TRAIT)) &&
- (from.hasFlag(Flags.MODULE) == to.hasFlag(Flags.MODULE))
+ (from.hasTraitFlag == to.hasTraitFlag) &&
+ (from.hasModuleFlag == to.hasModuleFlag)
// For testing purposes only, order irrelevant for compilation
def toStringSet(set: Set[AbstractFile]): String =
@@ -159,7 +159,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
case _ =>
// a new top level definition
changesOf(sym) =
- sym.info.parents.filter(_.typeSymbol hasFlag Flags.SEALED).map(
+ sym.info.parents.filter(_.typeSymbol.isSealed).map(
p => changeChangeSet(p.typeSymbol,
sym+" extends a sealed "+p.typeSymbol))
}
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
index 1f071e2288..1dfab2a98a 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
@@ -615,8 +615,8 @@ trait JavaParsers extends JavaScanners {
def varDecl(pos: Position, mods: Modifiers, tpt: Tree, name: Name): ValDef = {
val tpt1 = optArrayBrackets(tpt)
- if (in.token == ASSIGN && !(mods hasFlag Flags.PARAM)) skipTo(COMMA, SEMI)
- val mods1 = if (mods hasFlag Flags.FINAL) mods &~ Flags.FINAL else mods | Flags.MUTABLE
+ if (in.token == ASSIGN && !mods.isParameter) skipTo(COMMA, SEMI)
+ val mods1 = if (mods.isFinal) mods &~ Flags.FINAL else mods | Flags.MUTABLE
atPos(pos) {
ValDef(mods1, name, tpt1, blankExpr)
}
@@ -771,7 +771,7 @@ trait JavaParsers extends JavaScanners {
} else {
if (in.token == ENUM || definesInterface(in.token)) mods |= Flags.STATIC
val decls = memberDecl(mods, parentToken)
- (if ((mods hasFlag Flags.STATIC) || inInterface && !(decls exists (_.isInstanceOf[DefDef])))
+ (if (mods.hasStaticFlag || inInterface && !(decls exists (_.isInstanceOf[DefDef])))
statics
else
members) ++= decls
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
index 8a0702251d..4b717f209c 100644
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
@@ -110,7 +110,7 @@ trait ParallelMatching extends ast.TreeDSL
// tests
def isDefined = sym ne NoSymbol
def isSimple = tpe.isByte || tpe.isShort || tpe.isChar || tpe.isInt
- def isCaseClass = tpe.typeSymbol hasFlag Flags.CASE
+ def isCaseClass = tpe.typeSymbol.isCase
// sequences
def seqType = tpe.widen baseType SeqClass
diff --git a/src/compiler/scala/tools/nsc/matching/Patterns.scala b/src/compiler/scala/tools/nsc/matching/Patterns.scala
index 26ad296614..ec0939c2d6 100644
--- a/src/compiler/scala/tools/nsc/matching/Patterns.scala
+++ b/src/compiler/scala/tools/nsc/matching/Patterns.scala
@@ -474,7 +474,7 @@ trait Patterns extends ast.TreeDSL {
def isSymValid = (sym != null) && (sym != NoSymbol)
def isModule = sym.isModule || tpe.termSymbol.isModule
- def isCaseClass = tpe.typeSymbol hasFlag Flags.CASE
+ def isCaseClass = tpe.typeSymbol.isCase
def isObject = isSymValid && prefix.isStable // XXX not entire logic
def unadorn(t: Tree): Tree = Pattern unadorn t
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index 2452081c05..fb1e705a56 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -176,7 +176,7 @@ abstract class SymbolLoaders {
def openPackageModule(module: Symbol)(packageClass: Symbol = module.owner): Unit = {
// unlink existing symbols in the package
for (member <- module.info.decls.iterator) {
- if (!member.hasFlag(PRIVATE) && !member.isConstructor) {
+ if (!member.isPrivate && !member.isConstructor) {
// todo: handle overlapping definitions in some way: mark as errors
// or treat as abstractions. For now the symbol in the package module takes precedence.
for (existing <- packageClass.info.decl(member.name).alternatives)
@@ -185,7 +185,7 @@ abstract class SymbolLoaders {
}
// enter non-private decls the class
for (member <- module.info.decls.iterator) {
- if (!member.hasFlag(PRIVATE) && !member.isConstructor) {
+ if (!member.isPrivate && !member.isConstructor) {
packageClass.info.decls.enter(member)
}
}
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index 34a9dfa5cd..4bc9477a40 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -337,13 +337,13 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
*/
final def isValue = isTerm && !(isModule && hasFlag(PACKAGE | JAVA))
- final def isVariable = isTerm && hasFlag(MUTABLE) && !isMethod
+ final def isVariable = isTerm && isMutable && !isMethod
// interesting only for lambda lift. Captured variables are accessed from inner lambdas.
final def isCapturedVariable = isVariable && hasFlag(CAPTURED)
- final def isGetter = isTerm && hasFlag(ACCESSOR) && !nme.isSetterName(name)
- final def isSetter = isTerm && hasFlag(ACCESSOR) && nme.isSetterName(name)
+ final def isGetter = isTerm && hasAccessorFlag && !nme.isSetterName(name)
+ final def isSetter = isTerm && hasAccessorFlag && nme.isSetterName(name)
//todo: make independent of name, as this can be forged.
final def hasGetter = isTerm && nme.isLocalName(name)
@@ -434,7 +434,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
/** Does this symbol denote a stable value? */
final def isStable =
isTerm &&
- !hasFlag(MUTABLE) &&
+ !isMutable &&
(!hasFlag(METHOD | BYNAMEPARAM) || hasFlag(STABLE)) &&
!(tpe.isVolatile && !hasAnnotation(uncheckedStableClass))
@@ -1099,7 +1099,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
/** The symbol accessed by this accessor function, but with given owner type */
final def accessed(ownerTp: Type): Symbol = {
- assert(hasFlag(ACCESSOR))
+ assert(hasAccessorFlag)
ownerTp.decl(nme.getterToLocal(if (isSetter) nme.setterToGetter(name) else name))
}
@@ -1366,7 +1366,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
*/
final def getter(base: Symbol): Symbol = {
val getterName = if (isSetter) nme.setterToGetter(name) else nme.getterName(name)
- base.info.decl(getterName) filter (_.hasFlag(ACCESSOR))
+ base.info.decl(getterName) filter (_.hasAccessorFlag)
}
/** The setter of this value or getter definition, or NoSymbol if none exists */
@@ -1375,7 +1375,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
final def setter(base: Symbol, hasExpandedName: Boolean): Symbol = {
var sname = nme.getterToSetter(nme.getterName(name))
if (hasExpandedName) sname = nme.expandedSetterName(sname, base)
- base.info.decl(sname) filter (_.hasFlag(ACCESSOR))
+ base.info.decl(sname) filter (_.hasAccessorFlag)
}
/** The case module corresponding to this case class
@@ -1416,7 +1416,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
def expandName(base: Symbol) {
if (this.isTerm && this != NoSymbol && !hasFlag(EXPANDEDNAME)) {
setFlag(EXPANDEDNAME)
- if (hasFlag(ACCESSOR) && !isDeferred) {
+ if (hasAccessorFlag && !isDeferred) {
accessed.expandName(base)
} else if (hasGetter) {
getter(owner).expandName(base)
@@ -1476,7 +1476,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
else if (isPackage) "package"
else if (isModule) "object"
else if (isSourceMethod) "def"
- else if (isTerm && (!isParameter || hasFlag(PARAMACCESSOR))) "val"
+ else if (isTerm && (!isParameter || isParamAccessor)) "val"
else ""
/** String representation of symbol's kind */
@@ -1664,13 +1664,13 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
}
def setLazyAccessor(sym: Symbol): TermSymbol = {
- assert(hasFlag(LAZY) && (referenced == NoSymbol || referenced == sym), this)
+ assert(isLazy && (referenced == NoSymbol || referenced == sym), this)
referenced = sym
this
}
override def lazyAccessor: Symbol = {
- assert(hasFlag(LAZY), this)
+ assert(isLazy, this)
referenced
}
@@ -1696,7 +1696,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
}
}
- if (hasFlag(JAVA))
+ if (isJavaDefined)
cook(this)
else if (hasFlag(OVERLOADED))
for (sym2 <- alternatives)
@@ -1709,18 +1709,18 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
class ModuleSymbol(initOwner: Symbol, initPos: Position, initName: Name)
extends TermSymbol(initOwner, initPos, initName) {
private var flatname = nme.EMPTY
+ // This method could use a better name from someone clearer on what the condition expresses.
+ private def isFlatAdjusted = phase.flatClasses && !isMethod && rawowner != NoSymbol && !rawowner.isPackageClass
override def owner: Symbol =
- if (phase.flatClasses && !hasFlag(METHOD) &&
- rawowner != NoSymbol && !rawowner.isPackageClass) rawowner.owner
+ if (isFlatAdjusted) rawowner.owner
else rawowner
override def name: Name =
- if (phase.flatClasses && !hasFlag(METHOD) &&
- rawowner != NoSymbol && !rawowner.isPackageClass) {
+ if (isFlatAdjusted) {
if (flatname == nme.EMPTY) {
assert(rawowner.isClass, "fatal: %s has owner %s, but a class owner is required".format(rawname, rawowner))
- flatname = newTermName(compactify(rawowner.name.toString() + "$" + rawname))
+ flatname = newTermName(compactify(rawowner.name + "$" + rawname))
}
flatname
} else rawname
@@ -1834,7 +1834,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
* info for T in Test1 should be >: Nothing <: Test3[_]
*/
protected def doCookJavaRawInfo() {
- // don't require hasFlag(JAVA), since T in the above example does not have that flag
+ // don't require isJavaDefined, since T in the above example does not have that flag
val tpe1 = rawToExistential(info)
// println("cooking type: "+ this +": "+ info +" to "+ tpe1)
if (tpe1 ne info) {
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 7a5d4544fc..108bb2f8cc 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -899,12 +899,12 @@ trait Types extends reflect.generic.Types { self: SymbolTable =>
if (name == nme.ANYNAME) decls.elems else decls.lookupEntry(name)
while (entry ne null) {
val sym = entry.sym
- if (sym.getFlag(requiredFlags) == requiredFlags) {
+ if (sym hasAllFlags requiredFlags) {
val excl = sym.getFlag(excluded)
if (excl == 0L &&
(// omit PRIVATE LOCALS unless selector class is contained in class owning the def.
(bcs eq bcs0) ||
- sym.getFlag(PRIVATE | LOCAL) != (PRIVATE | LOCAL).toLong ||
+ !sym.isPrivateLocal ||
(bcs0.head.hasTransOwner(bcs.head)))) {
if (name.isTypeName || stableOnly && sym.isStable) {
stopTimer(findMemberNanos, start)
@@ -916,7 +916,7 @@ trait Types extends reflect.generic.Types { self: SymbolTable =>
if (member.name != sym.name ||
!(member == sym ||
member.owner != sym.owner &&
- !sym.hasFlag(PRIVATE) && {
+ !sym.isPrivate && {
if (self eq null) self = this.narrow
if (membertpe eq null) membertpe = self.memberType(member)
(membertpe matches self.memberType(sym))
@@ -1183,7 +1183,7 @@ trait Types extends reflect.generic.Types { self: SymbolTable =>
// more precise conceptually, but causes cyclic errors: (paramss exists (_ contains sym))
override def isImmediatelyDependent = (sym ne NoSymbol) && (sym.owner.isMethod && sym.isValueParameter)
- override def isVolatile : Boolean = underlying.isVolatile && (!sym.isStable)
+ override def isVolatile : Boolean = underlying.isVolatile && !sym.isStable
/*
override def narrow: Type = {
if (phase.erasedTypes) this
@@ -1918,7 +1918,7 @@ A type's typeSymbol should never be inspected directly.
return normalize.typeArgs.init.mkString("(", ", ", ")") + " => " + normalize.typeArgs.last
if (isTupleTypeOrSubtype(this))
return normalize.typeArgs.mkString("(", ", ", if (normalize.typeArgs.length == 1) ",)" else ")")
- if (sym.isAliasType && (prefixChain exists (_.termSymbol hasFlag SYNTHETIC))) {
+ if (sym.isAliasType && (prefixChain exists (_.termSymbol.isSynthetic))) {
val normed = normalize;
if (normed ne this) return normed.toString
}
@@ -1942,7 +1942,7 @@ A type's typeSymbol should never be inspected directly.
thisInfo.parents.mkString(" with ") + {
if (sym.isStructuralRefinement)
((decls.toList filter { entry =>
- !entry.isConstructor && entry.allOverriddenSymbols.isEmpty && !entry.hasFlag(PRIVATE)
+ !entry.isConstructor && entry.allOverriddenSymbols.isEmpty && !entry.isPrivate
}) map { entry => entry.defString }).mkString("{", "; ", "}")
else
""
@@ -3236,7 +3236,7 @@ A type's typeSymbol should never be inspected directly.
// note: it's important to write the two tests in this order,
// as only typeParams forces the classfile to be read. See #400
private def isRawIfWithoutArgs(sym: Symbol) =
- sym.isClass && !sym.typeParams.isEmpty && sym.hasFlag(JAVA)
+ sym.isClass && sym.typeParams.nonEmpty && sym.isJavaDefined
def isRaw(sym: Symbol, args: List[Type]) =
!phase.erasedTypes && isRawIfWithoutArgs(sym) && args.isEmpty
@@ -4036,7 +4036,7 @@ A type's typeSymbol should never be inspected directly.
}
private def equalSymsAndPrefixes(sym1: Symbol, pre1: Type, sym2: Symbol, pre2: Type): Boolean =
- if (sym1 == sym2) sym1.hasFlag(PACKAGE) || phase.erasedTypes || pre1 =:= pre2
+ if (sym1 == sym2) sym1.hasPackageFlag || phase.erasedTypes || pre1 =:= pre2
else (sym1.name == sym2.name) && isUnifiable(pre1, pre2)
/** Do `tp1' and `tp2' denote equivalent types?
@@ -4084,7 +4084,7 @@ A type's typeSymbol should never be inspected directly.
def normalizePlus(tp: Type) = tp match {
case TypeRef(pre, sym, List()) =>
if (!sym.isInitialized) sym.rawInfo.load(sym)
- if (sym.hasFlag(JAVA) && !sym.typeParams.isEmpty) rawToExistential(tp)
+ if (sym.isJavaDefined && !sym.typeParams.isEmpty) rawToExistential(tp)
else tp.normalize
case _ => tp.normalize
}
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index cbc79b215d..525815a6b2 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -756,7 +756,7 @@ abstract class ClassfileParser {
}
val classSym = classNameToSymbol(subName(c => c == ';' || c == '<'))
- assert(!classSym.hasFlag(OVERLOADED), classSym.alternatives)
+ assert(!classSym.isOverloaded, classSym.alternatives)
var tpe = processClassType(processInner(classSym.tpe))
while (sig(index) == '.') {
accept('.')
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
index 95a0c2b53d..0c4dc9a961 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
@@ -45,7 +45,7 @@ abstract class ICodeReader extends ClassfileParser {
var sym = cls
sym.info // ensure accurate type information
- isScalaModule = cls.isModule && !cls.hasFlag(JAVA)
+ isScalaModule = cls.isModule && !cls.isJavaDefined
log("Reading class: " + cls + " isScalaModule?: " + isScalaModule)
val name = cls.fullName('.') + (if (sym.hasFlag(MODULE)) "$" else "")
@@ -506,7 +506,7 @@ abstract class ICodeReader extends ClassfileParser {
case JVM.getstatic =>
val field = pool.getMemberSymbol(in.nextChar, true); size += 2
- if (field.hasFlag(Flags.MODULE))
+ if (field.hasModuleFlag)
code.emit(LOAD_MODULE(field))
else
code.emit(LOAD_FIELD(field, true))
@@ -529,7 +529,7 @@ abstract class ICodeReader extends ClassfileParser {
code.emit(CALL_METHOD(m, Dynamic))
case JVM.invokespecial =>
val m = pool.getMemberSymbol(in.nextChar, false); size += 2
- val style = if (m.name == nme.CONSTRUCTOR || m.hasFlag(Flags.PRIVATE)) Static(true)
+ val style = if (m.name == nme.CONSTRUCTOR || m.isPrivate) Static(true)
else SuperCall(m.owner.name);
code.emit(CALL_METHOD(m, style))
case JVM.invokestatic =>
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index 3b63ce2862..6fab87e9f6 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -91,7 +91,7 @@ abstract class Pickler extends SubComponent {
(isRootSym(sym) ||
sym.isRefinementClass ||
sym.isAbstractType && sym.hasFlag(EXISTENTIAL) || // existential param
- (sym hasFlag PARAM) ||
+ sym.isParameter ||
isLocal(sym.owner))
private def staticAnnotations(annots: List[AnnotationInfo]) =
@@ -497,7 +497,7 @@ abstract class Pickler extends SubComponent {
writeRef(sym.name)
writeRef(localizedOwner(sym))
writeLongNat((rawFlagsToPickled(sym.flags & PickledFlags)))
- if (sym.privateWithin != NoSymbol) writeRef(sym.privateWithin)
+ if (sym.hasAccessBoundary) writeRef(sym.privateWithin)
writeRef(sym.info)
}
@@ -990,7 +990,7 @@ abstract class Pickler extends SubComponent {
printRef(sym.name)
printRef(localizedOwner(sym))
print(flagsToString(sym.flags & PickledFlags)+" ")
- if (sym.privateWithin != NoSymbol) printRef(sym.privateWithin)
+ if (sym.hasAccessBoundary) printRef(sym.privateWithin)
printRef(sym.info)
}
def printBody(entry: AnyRef) = entry match {
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
index a2e7f425b6..afafce5abe 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
@@ -65,7 +65,7 @@ abstract class UnPickler extends reflect.generic.UnPickler {
override def complete(sym: Symbol) {
super.complete(sym)
var alias = at(j, readSymbol)
- if (alias hasFlag OVERLOADED) {
+ if (alias.isOverloaded) {
atPhase(currentRun.picklerPhase) {
alias = alias suchThat (alt => sym.tpe =:= sym.owner.thisType.memberType(alt))
}
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index 252055a63f..98ae175dad 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -197,15 +197,15 @@ abstract class AddInterfaces extends InfoTransform {
clazz setFlag lateINTERFACE
implClass(clazz) // generate an impl class
}
- val parents1 =
- if (parents.isEmpty) List()
- else {
- assert(!parents.head.typeSymbol.isTrait, clazz)
- if (clazz.isTrait) erasedTypeRef(ObjectClass) :: parents.tail
+ val parents1 = parents match {
+ case Nil => Nil
+ case hd :: tl =>
+ assert(!hd.typeSymbol.isTrait, clazz)
+ if (clazz.isTrait) erasedTypeRef(ObjectClass) :: tl
else parents
- }
+ }
val decls1 = decls filter (sym =>
- if (clazz hasFlag INTERFACE) isInterfaceMember(sym)
+ if (clazz.isInterface) isInterfaceMember(sym)
else (!sym.isType || sym.isClass))
//if (!clazz.isPackageClass) System.out.println("Decls of "+clazz+" after explicitOuter = " + decls1);//DEBUG
@@ -271,18 +271,11 @@ abstract class AddInterfaces extends InfoTransform {
}
def implClassDefs(trees: List[Tree]): List[Tree] = {
- val buf = new ListBuffer[Tree]
- for (tree <- trees)
- tree match {
- case ClassDef(_, _, _, impl) =>
- if (tree.symbol.needsImplClass)
- buf += {
- val clazz = implClass(tree.symbol).initialize
- ClassDef(clazz, implTemplate(clazz, impl))
- }
- case _ =>
- }
- buf.toList
+ trees collect {
+ case cd: ClassDef if cd.symbol.needsImplClass =>
+ val clazz = implClass(cd.symbol).initialize
+ ClassDef(clazz, implTemplate(clazz, cd.impl))
+ }
}
/** Add calls to supermixin constructors
@@ -302,7 +295,7 @@ abstract class AddInterfaces extends InfoTransform {
(tree: @unchecked) match {
case Block(stats, expr) =>
// needs `hasSymbol' check because `supercall' could be a block (named / default args)
- val (presuper, supercall :: rest) = stats span (t => t.hasSymbol && t.symbol.hasFlag(PRESUPER))
+ val (presuper, supercall :: rest) = stats span (t => t.hasSymbolWhich(_ hasFlag PRESUPER))
//assert(supercall.symbol.isClassConstructor, supercall)
treeCopy.Block(tree, presuper ::: (supercall :: mixinConstructorCalls ::: rest), expr)
}
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index 2d9c89bea0..af41bb97e9 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -650,7 +650,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
/* finds the static ctor DefDef tree within the template if it exists. */
private def findStaticCtor(template: Template): Option[Tree] =
template.body find {
- case defdef @ DefDef(mods, nme.CONSTRUCTOR, tparam, vparam, tp, rhs) => defdef.symbol hasFlag STATIC
+ case defdef @ DefDef(_, nme.CONSTRUCTOR, _, _, _, _) => defdef.symbol.hasStaticFlag
case _ => false
}
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index 88ecab6363..ed479763e5 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -198,7 +198,7 @@ abstract class Constructors extends Transform with ast.TreeDSL {
// before the superclass constructor call, otherwise it goes after.
// Lazy vals don't get the assignment in the constructor.
if (!stat.symbol.tpe.isInstanceOf[ConstantType]) {
- if (rhs != EmptyTree && !stat.symbol.hasFlag(LAZY)) {
+ if (rhs != EmptyTree && !stat.symbol.isLazy) {
val rhs1 = intoConstructor(stat.symbol, rhs);
(if (canBeMoved(stat)) constrPrefixBuf else constrStatBuf) += mkAssign(
stat.symbol, rhs1)
@@ -225,10 +225,10 @@ abstract class Constructors extends Transform with ast.TreeDSL {
// This is the case if the symbol is defined in the current class, and
// ( the symbol is an object private parameter accessor field, or
// the symbol is an outer accessor of a final class which does not override another outer accessor. )
- def maybeOmittable(sym: Symbol) =
- (sym.owner == clazz &&
- ((sym hasFlag PARAMACCESSOR) && sym.isPrivateLocal ||
- sym.isOuterAccessor && sym.owner.isFinal && sym.allOverriddenSymbols.isEmpty))
+ def maybeOmittable(sym: Symbol) = sym.owner == clazz && (
+ sym.isParamAccessor && sym.isPrivateLocal ||
+ sym.isOuterAccessor && sym.owner.isFinal && sym.allOverriddenSymbols.isEmpty
+ )
// Is symbol known to be accessed outside of the primary constructor,
// or is it a symbol whose definition cannot be omitted anyway?
@@ -426,7 +426,7 @@ abstract class Constructors extends Transform with ast.TreeDSL {
override def transform(tree: Tree): Tree =
tree match {
- case ClassDef(mods, name, tparams, impl) if !tree.symbol.hasFlag(INTERFACE) =>
+ case ClassDef(mods, name, tparams, impl) if !tree.symbol.isInterface =>
treeCopy.ClassDef(tree, mods, name, tparams, transformClassTemplate(impl))
case _ =>
super.transform(tree)
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index cfd78b7b08..9a436d86a3 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -671,7 +671,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast.
case Try(block, catches, finalizer) =>
treeCopy.Try(tree1, adaptBranch(block), catches map adaptCase, finalizer)
case Ident(_) | Select(_, _) =>
- if (tree1.symbol hasFlag OVERLOADED) {
+ if (tree1.symbol.isOverloaded) {
val first = tree1.symbol.alternatives.head
val sym1 = tree1.symbol.filter {
alt => alt == first || !(first.tpe looselyMatches alt.tpe)
@@ -745,7 +745,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast.
val opc = new overridingPairs.Cursor(root) {
override def exclude(sym: Symbol): Boolean =
- (!sym.isTerm || sym.hasFlag(PRIVATE) || super.exclude(sym)
+ (!sym.isTerm || sym.isPrivate || super.exclude(sym)
// specialized members have no type history before 'specialize', causing double def errors for curried defs
|| !sym.hasTypeAt(currentRun.refchecksPhase.id))
@@ -813,7 +813,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast.
new overridingPairs.Cursor(owner) {
override def parents: List[Type] = List(owner.info.parents.head)
override def exclude(sym: Symbol): Boolean =
- !sym.isMethod || sym.hasFlag(PRIVATE) || super.exclude(sym)
+ !sym.isMethod || sym.isPrivate || super.exclude(sym)
}
}
while (opc.hasNext) {
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 1403377367..9f6117dcf1 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -161,8 +161,8 @@ abstract class ExplicitOuter extends InfoTransform
// On the other hand, mixing in the trait into a separately compiled
// class needs to have a common naming scheme, independently of whether
// the field was accessed from an inner class or not. See #2946
- if (sym.owner.isTrait && (sym hasFlag LOCAL) &&
- ((sym.getter(sym.owner.toInterface) == NoSymbol) && (!sym.isLazy || (sym.lazyAccessor == NoSymbol))))
+ if (sym.owner.isTrait && sym.hasLocalFlag &&
+ ((sym.getter(sym.owner.toInterface) == NoSymbol) && !sym.isLazyAccessor))
sym.makeNotPrivate(sym.owner)
tp
}
@@ -343,12 +343,9 @@ abstract class ExplicitOuter extends InfoTransform
/** If FLAG is set on symbol, sets notFLAG (this exists in anticipation of generalizing). */
def setNotFlags(sym: Symbol, flags: Int*) {
- val notMap = Map(
- PRIVATE -> notPRIVATE,
- PROTECTED -> notPROTECTED
- )
- for (f <- flags ; notFlag <- notMap get f ; if sym hasFlag f)
- sym setFlag notFlag
+ for (f <- flags ; notFlag <- notFlagMap get f)
+ if (sym hasFlag f)
+ sym setFlag notFlag
}
def matchTranslation(tree: Match) = {
@@ -461,7 +458,7 @@ abstract class ExplicitOuter extends InfoTransform
super.transform(tree)
case This(qual) =>
- if (sym == currentClass || (sym hasFlag MODULE) && sym.isStatic) tree
+ if (sym == currentClass || sym.hasModuleFlag && sym.isStatic) tree
else atPos(tree.pos)(outerPath(outerValue, currentClass.outerClass, sym)) // (5)
case Select(qual, name) =>
diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala
index 512c5fe2bd..704cf35853 100644
--- a/src/compiler/scala/tools/nsc/transform/Flatten.scala
+++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala
@@ -51,7 +51,7 @@ abstract class Flatten extends InfoTransform {
decls1 enter sym
if (sym.isModule) sym.moduleClass setFlag LIFTED // Only top modules
// Nested modules (MODULE flag is reset so we access through lazy):
- if (sym.isModuleVar && sym.hasFlag(LAZY)) sym.lazyAccessor.lazyAccessor setFlag LIFTED
+ if (sym.isModuleVar && sym.isLazy) sym.lazyAccessor.lazyAccessor setFlag LIFTED
} else if (sym.isClass) {
liftClass(sym)
if (sym.needsImplClass) liftClass(erasure.implClass(sym))
@@ -83,7 +83,7 @@ abstract class Flatten extends InfoTransform {
tree match {
case PackageDef(_, _) =>
liftedDefs(tree.symbol.moduleClass) = new ListBuffer
- case Template(_, _, _) if (tree.symbol.owner.hasFlag(PACKAGE)) =>
+ case Template(_, _, _) if tree.symbol.owner.hasPackageFlag =>
liftedDefs(tree.symbol.owner) = new ListBuffer
case _ =>
}
diff --git a/src/compiler/scala/tools/nsc/transform/LazyVals.scala b/src/compiler/scala/tools/nsc/transform/LazyVals.scala
index 9baec23129..84916606a3 100644
--- a/src/compiler/scala/tools/nsc/transform/LazyVals.scala
+++ b/src/compiler/scala/tools/nsc/transform/LazyVals.scala
@@ -65,7 +65,7 @@ abstract class LazyVals extends Transform with TypingTransformers with ast.TreeD
tree match {
case DefDef(mods, name, tparams, vparams, tpt, rhs) => atOwner(tree.symbol) {
- val res = if (!sym.owner.isClass && sym.hasFlag(LAZY)) {
+ val res = if (!sym.owner.isClass && sym.isLazy) {
val enclosingDummyOrMethod =
if (sym.enclMethod == NoSymbol) sym.owner else sym.enclMethod
val idx = lazyVals(enclosingDummyOrMethod)
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 3d4c41ed93..5b6f19c18e 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -43,7 +43,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
private def isImplementedStatically(sym: Symbol) =
sym.owner.isImplClass && sym.isMethod &&
(!sym.isModule || sym.hasFlag(PRIVATE | LIFTED)) &&
- (!(sym hasFlag (ACCESSOR | SUPERACCESSOR)) || sym.hasFlag(LAZY))
+ (!(sym hasFlag (ACCESSOR | SUPERACCESSOR)) || sym.isLazy)
/** A member of a trait is static only if it belongs only to the
* implementation class, not the interface, and it is implemented
@@ -114,8 +114,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
// --------- type transformation -----------------------------------------------
def isConcreteAccessor(member: Symbol) =
- (member hasFlag ACCESSOR) &&
- (!(member hasFlag DEFERRED) || (member hasFlag lateDEFERRED))
+ member.hasAccessorFlag && (!member.isDeferred || (member hasFlag lateDEFERRED))
/** Is member overridden (either directly or via a bridge) in base class sequence `bcs'? */
def isOverriddenAccessor(member: Symbol, bcs: List[Symbol]): Boolean = atPhase(ownPhase) {
@@ -138,9 +137,10 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
member setFlag MIXEDIN
}
- def needsExpandedSetterName(field: Symbol) =
- !(field hasFlag LAZY) &&
- (if (field.isMethod) (field hasFlag STABLE) else !(field hasFlag MUTABLE))
+ def needsExpandedSetterName(field: Symbol) = !field.isLazy && (
+ if (field.isMethod) field.hasStableFlag
+ else !field.isMutable
+ )
/** Add getters and setters for all non-module fields of an implementation
* class to its interface unless they are already present. This is done
@@ -162,7 +162,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
// }
clazz.newMethod(field.pos, nme.getterName(field.name))
.setFlag(field.flags & ~(PRIVATE | LOCAL) | ACCESSOR | lateDEFERRED |
- (if (field hasFlag MUTABLE) 0 else STABLE))
+ (if (field.isMutable) 0 else STABLE))
.setInfo(MethodType(List(), field.info)) // TODO preserve pre-erasure info?
}
@@ -188,12 +188,12 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
for (member <- impl.info.decls.toList) {
if (!member.isMethod && !member.isModule && !member.isModuleVar) {
assert(member.isTerm && !member.isDeferred, member)
- if (member.getter(impl) hasFlag PRIVATE) {
+ if (member.getter(impl).isPrivate) {
member.makeNotPrivate(clazz) // this will also make getter&setter not private
}
val getter = member.getter(clazz)
if (getter == NoSymbol) addMember(clazz, newGetter(member))
- if (!member.tpe.isInstanceOf[ConstantType] && !member.hasFlag(LAZY)) {
+ if (!member.tpe.isInstanceOf[ConstantType] && !member.isLazy) {
val setter = member.setter(clazz, needsExpandedSetterName(member))
if (setter == NoSymbol) addMember(clazz, newSetter(member))
}
@@ -278,7 +278,8 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
for (member <- mixinClass.info.decls.toList) {
if (isConcreteAccessor(member)) {
if (isOverriddenAccessor(member, clazz.info.baseClasses)) {
- if (settings.debug.value) println("!!! is overridden val: "+member)
+ if (settings.debug.value)
+ println("!!! is overridden val: "+member)
} else {
// mixin field accessors
val member1 = addMember(
@@ -290,7 +291,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
// atPhase(currentRun.erasurePhase){
// println("before erasure: "+ (member.info, member1.info))
// }
- if (member.hasFlag(LAZY)) {
+ if (member.isLazy) {
var init = implClass(mixinClass).info.decl(member.name)
assert(init != NoSymbol, "Could not find initializer for " + member.name)
initializer(member1) = init
@@ -314,17 +315,17 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
addMember(clazz,
sym
setFlag (LOCAL | PRIVATE | member.getFlag(MUTABLE | LAZY))
- setFlag (if (!member.hasFlag(STABLE)) MUTABLE else 0)
+ setFlag (if (!member.hasStableFlag) MUTABLE else 0)
setAnnotations accessed.annotations)
}
}
- } else if (member hasFlag SUPERACCESSOR) { // mixin super accessors
+ } else if (member.isSuperAccessor) { // mixin super accessors
val member1 = addMember(clazz, member.cloneSymbol(clazz)) setPos clazz.pos
assert(member1.alias != NoSymbol, member1)
val alias1 = rebindSuper(clazz, member.alias, mixinClass)
member1.asInstanceOf[TermSymbol] setAlias alias1
- } else if (member.isMethod && member.isModule && !(member hasFlag (LIFTED | BRIDGE))) {
+ } else if (member.isMethod && member.isModule && member.hasNoFlags(LIFTED | BRIDGE)) {
// mixin objects: todo what happens with abstract objects?
addMember(clazz, member.cloneSymbol(clazz))
.setPos(clazz.pos)
@@ -414,12 +415,12 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
case _ =>
if (tree.hasSymbol && tree.symbol != NoSymbol) {
val sym = tree.symbol
- if ((sym.hasFlag(ACCESSOR) || (sym.isTerm && !sym.isMethod))
- && sym.hasFlag(PRIVATE)
+ if ((sym.hasAccessorFlag || (sym.isTerm && !sym.isMethod))
+ && sym.isPrivate
&& !(currentOwner.isGetter && currentOwner.accessed == sym) // getter
&& !definitions.isValueClass(sym.tpe.resultType.typeSymbol)
&& sym.owner == templ.symbol.owner
- && !sym.hasFlag(LAZY)
+ && !sym.isLazy
&& !tree.isDef) {
log("added use in: " + currentOwner + " -- " + tree)
usedIn(sym) ::= currentOwner
@@ -432,11 +433,10 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
}
SingleUseTraverser(templ)
log("usedIn: " + usedIn)
- usedIn filter { pair =>
- val member = pair._2.head
- (member.isValue
- && member.hasFlag(LAZY)
- && pair._2.tail.isEmpty) }
+ usedIn filter {
+ case (_, member :: Nil) => member.isValue && member.isLazy
+ case _ => false
+ }
}
// --------- term transformation -----------------------------------------------
@@ -631,7 +631,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
*/
def completeSuperAccessor(stat: Tree) = stat match {
case DefDef(mods, name, tparams, List(vparams), tpt, EmptyTree)
- if (stat.symbol hasFlag SUPERACCESSOR) =>
+ if (stat.symbol.isSuperAccessor) =>
val rhs0 = (Super(clazz, nme.EMPTY.toTypeName) DOT stat.symbol.alias)(vparams map (v => Ident(v.symbol)): _*)
val rhs1 = localTyper.typed(atPos(stat.pos)(rhs0), stat.symbol.tpe.resultType)
val rhs2 = atPhase(currentRun.mixinPhase)(transform(rhs1))
@@ -779,7 +779,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
*/
def mkLazyDef(clazz: Symbol, lzyVal: Symbol, init: List[Tree], retVal: Tree, offset: Int): Tree = {
def nullify(sym: Symbol): Tree = {
- val sym1 = if (sym.hasFlag(ACCESSOR)) sym.accessed else sym
+ val sym1 = if (sym.hasAccessorFlag) sym.accessed else sym
Select(This(clazz), sym1) === LIT(null)
}
@@ -814,7 +814,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
val stats1 = for (stat <- stats; sym = stat.symbol) yield stat match {
case DefDef(mods, name, tp, vp, tpt, rhs)
- if sym.hasFlag(LAZY) && rhs != EmptyTree && !clazz.isImplClass =>
+ if sym.isLazy && rhs != EmptyTree && !clazz.isImplClass =>
assert(fieldOffset.isDefinedAt(sym))
val rhs1 = if (sym.tpe.resultType.typeSymbol == UnitClass)
mkLazyDef(clazz, sym, List(rhs), UNIT, fieldOffset(sym))
@@ -861,8 +861,8 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
// if (settings.debug.value) {
// log("needsInitFlag(" + sym.fullName + "): " + res)
// log("\tsym.isGetter: " + sym.isGetter)
-// log("\t!isInitializedToDefault: " + !sym.isInitializedToDefault + sym.hasFlag(DEFAULTINIT) + sym.hasFlag(ACCESSOR) + sym.isTerm)
-// log("\t!sym.hasFlag(PARAMACCESSOR): " + !sym.hasFlag(PARAMACCESSOR))
+// log("\t!isInitializedToDefault: " + !sym.isInitializedToDefault + sym.hasFlag(DEFAULTINIT) + sym.hasAccessorFlag + sym.isTerm)
+// log("\t!sym.isParamAccessor: " + !sym.isParamAccessor)
// //println("\t!sym.accessed.hasFlag(PRESUPER): " + !sym.accessed.hasFlag(PRESUPER))
// log("\t!sym.isOuterAccessor: " + !sym.isOuterAccessor)
// }
@@ -967,7 +967,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
case MethodType(List(), ConstantType(c)) => Literal(c)
case _ =>
// if it is a mixed-in lazy value, complete the accessor
- if (sym.hasFlag(LAZY) && sym.isGetter) {
+ if (sym.isLazy && sym.isGetter) {
val rhs1 =
if (sym.tpe.resultType.typeSymbol == UnitClass)
mkLazyDef(clazz, sym, List(Apply(staticRef(initializer(sym)), List(gen.mkAttributedThis(clazz)))), UNIT, fieldOffset(sym))
@@ -1006,7 +1006,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
else
init
}
- } else if (!sym.hasFlag(LAZY) && needsInitFlag(sym)) {
+ } else if (!sym.isLazy && needsInitFlag(sym)) {
mkCheckedAccessor(clazz, accessedRef, fieldOffset(sym), sym.pos, sym)
} else
gen.mkCheckInit(accessedRef)
@@ -1014,7 +1014,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
} else if (!sym.isMethod) {
// add fields
addDef(position(sym), ValDef(sym))
- } else if (sym hasFlag SUPERACCESSOR) {
+ } else if (sym.isSuperAccessor) {
// add superaccessors
addDefDef(sym, vparams => EmptyTree)
} else {
@@ -1037,7 +1037,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
}
// if there are no lazy fields, take the fast path and save a traversal of the whole AST
- if (templ.symbol.owner.info.decls.exists(_.hasFlag(LAZY))) {
+ if (templ.symbol.owner.info.decls.exists(_.isLazy)) {
// check what fields can be nulled for
val uses = singleUseFields(templ)
for ((field, users) <- uses; lazyFld <- users) {
@@ -1117,7 +1117,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
if (mix == nme.EMPTY.toTypeName && currentOwner.enclClass.isImplClass)
assert(false, "illegal super in trait: " + currentOwner.enclClass + " " + tree);
if (sym.owner hasFlag lateINTERFACE) {
- if (sym.hasFlag(ACCESSOR)) {
+ if (sym.hasAccessorFlag) {
assert(args.isEmpty)
val sym1 = sym.overridingSymbol(currentOwner.enclClass)
typedPos(tree.pos)((transformSuper(qual) DOT sym1)())
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index d0d3235c8a..ed4808ebbd 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -485,7 +485,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
override def target = m.owner.info.member(specializedName(m, env))
}
- } else if (m.isMethod && !m.hasFlag(ACCESSOR)) { // other concrete methods
+ } else if (m.isMethod && !m.hasAccessorFlag) { // other concrete methods
forwardToOverload(m)
} else if (m.isValue && !m.isMethod) { // concrete value definition
@@ -869,7 +869,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
case PolyType(targs, ClassInfoType(base, decls, clazz))
if clazz != RepeatedParamClass
&& clazz != JavaRepeatedParamClass
- && !clazz.hasFlag(JAVA) =>
+ && !clazz.isJavaDefined =>
val parents = base map specializedType
if (settings.debug.value) log("transformInfo (poly) " + clazz + " with parents1: " + parents + " ph: " + phase)
// if (clazz.name.toString == "$colon$colon")
@@ -878,7 +878,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
new Scope(specializeClass(clazz, typeEnv(clazz)) ::: specialOverrides(clazz)),
clazz))
- case ClassInfoType(base, decls, clazz) if !clazz.isPackageClass && !clazz.hasFlag(JAVA) =>
+ case ClassInfoType(base, decls, clazz) if !clazz.isPackageClass && !clazz.isJavaDefined =>
atPhase(phase.next)(base.map(_.typeSymbol.info))
val parents = base map specializedType
if (settings.debug.value) log("transformInfo " + clazz + " with parents1: " + parents + " ph: " + phase)
@@ -1207,7 +1207,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
localTyper.typed(treeCopy.DefDef(tree, mods, name, tparams, vparamss, tpt, rhs1))
}
- case ValDef(mods, name, tpt, rhs) if symbol.hasFlag(SPECIALIZED) && !symbol.hasFlag(PARAMACCESSOR) =>
+ case ValDef(mods, name, tpt, rhs) if symbol.hasFlag(SPECIALIZED) && !symbol.isParamAccessor =>
assert(body.isDefinedAt(symbol.alias))
val tree1 = treeCopy.ValDef(tree, mods, name, tpt, body(symbol.alias).duplicate)
if (settings.debug.value) log("now typing: " + tree1 + " in " + tree.symbol.owner.fullName)
@@ -1325,7 +1325,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
&& satisfiable(typeEnv(m), warn(cls))) {
log("creating tree for " + m.fullName)
if (m.isMethod) {
- if (info(m).target.isGetterOrSetter) hasSpecializedFields = true
+ if (info(m).target.hasAccessorFlag) hasSpecializedFields = true
if (m.isClassConstructor) {
val origParamss = parameters(info(m).target)
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index e75a7f9580..26c1efbf91 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -274,7 +274,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
/** Undo eta expansion for parameterless and nullary methods */
def deEta(fun: Function): Tree = fun match {
case Function(List(), Apply(expr, List())) if treeInfo.isPureExpr(expr) =>
- if (expr.hasSymbol && expr.symbol.hasFlag(LAZY))
+ if (expr hasSymbolWhich (_.isLazy))
fun
else
expr
@@ -690,7 +690,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
applyUnary()
case Select(_, _) | TypeApply(_, _) =>
applyUnary()
- case Return(expr) if (tree.symbol != currentOwner.enclMethod || currentOwner.hasFlag(LAZY)) =>
+ case Return(expr) if (tree.symbol != currentOwner.enclMethod || currentOwner.isLazy) =>
if (settings.debug.value) log("non local return in "+tree.symbol+" from "+currentOwner.enclMethod)
atPos(tree.pos)(nonLocalReturnThrow(expr, tree.symbol))
case TypeTree() =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 7136945de6..ef0f38a341 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -430,12 +430,12 @@ trait Contexts { self: Analyzer =>
val ab = sym.accessBoundary(sym.owner)
( (ab.isTerm || ab == definitions.RootClass)
|| (accessWithin(ab) || accessWithinLinked(ab)) &&
- ( !sym.hasFlag(LOCAL)
+ ( !sym.hasLocalFlag
|| sym.owner.isImplClass // allow private local accesses to impl classes
- || (sym hasFlag PROTECTED) && isSubThisType(pre, sym.owner)
+ || sym.isProtected && isSubThisType(pre, sym.owner)
|| pre =:= sym.owner.thisType
)
- || (sym hasFlag PROTECTED) &&
+ || sym.isProtected &&
( superAccess
|| pre.isInstanceOf[ThisType]
|| sym.isConstructor
@@ -485,7 +485,7 @@ trait Contexts { self: Analyzer =>
* with the same names. Local symbols override imported ones. This fixes #2866.
*/
private def isQualifyingImplicit(sym: Symbol, pre: Type, imported: Boolean) =
- sym.hasFlag(IMPLICIT) &&
+ sym.isImplicit &&
isAccessible(sym, pre, false) &&
!(imported && {
val e = scope.lookupEntry(sym.name)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 70df60cc55..eb775f2301 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -548,7 +548,7 @@ self: Analyzer =>
def comesBefore(sym: Symbol, owner: Symbol) = {
val ownerPos = owner.pos.pointOrElse(Integer.MAX_VALUE)
sym.pos.pointOrElse(0) < ownerPos && (
- if(sym isGetterOrSetter) {
+ if(sym hasAccessorFlag) {
val symAcc = sym.accessed // #3373
symAcc.pos.pointOrElse(0) < ownerPos &&
!(owner.ownerChain exists (o => (o eq sym) || (o eq symAcc))) // probably faster to iterate only once, don't feel like duplicating hasTransOwner for this case
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 4d5fe9549c..095094579a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -707,7 +707,7 @@ trait Infer {
val argtpes1 = argtpes map {
case NamedType(name, tp) => // a named argument
var res = tp
- val pos = params.indexWhere(p => (p.name == name || deprecatedName(p) == Some(name)) && !p.hasFlag(SYNTHETIC))
+ val pos = params.indexWhere(p => (p.name == name || deprecatedName(p) == Some(name)) && !p.isSynthetic)
if (pos == -1) {
if (positionalAllowed) { // treat assignment as positional argument
argPos(index) = index
@@ -820,13 +820,12 @@ trait Infer {
case NamedType(name, _) => Some(name)
case _ => None
})._1
- if (missing.exists(!_.hasFlag(DEFAULTPARAM))) tryTupleApply
- else {
- val argtpes1 = argtpes0 ::: missing.map {
- p => NamedType(p.name, p.tpe) // add defaults as named arguments
- }
+ if (missing forall (_.hasDefaultFlag)) {
+ // add defaults as named arguments
+ val argtpes1 = argtpes0 ::: (missing map (p => NamedType(p.name, p.tpe)))
isApplicable(undetparams, ftpe, argtpes1, pt)
}
+ else tryTupleApply
}
case PolyType(tparams, restpe) =>
@@ -1679,7 +1678,7 @@ trait Infer {
else treeSymTypeMsg(tree) + " does not take type parameters")
return
}
- if (sym0.hasFlag(OVERLOADED)) {
+ if (sym0.isOverloaded) {
val sym = sym0 filter { alt => isWithinBounds(pre, alt.owner, alt.typeParams, argtypes) }
if (sym == NoSymbol) {
if (!(argtypes exists (_.isErroneous))) {
@@ -1691,7 +1690,7 @@ trait Infer {
return
}
}
- if (sym.hasFlag(OVERLOADED)) {
+ if (sym.isOverloaded) {
val tparams = new AsSeenFromMap(pre, sym.alternatives.head.owner).mapOver(
sym.alternatives.head.typeParams)
val bounds = tparams map (_.tpeHK) // see e.g., #1236
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 35b34ae5fd..e2098ee7d5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -68,7 +68,7 @@ trait Namers { self: Analyzer =>
val typer = newTyper(context)
def setPrivateWithin[Sym <: Symbol](tree: Tree, sym: Sym, mods: Modifiers): Sym = {
- if (!mods.privateWithin.isEmpty)
+ if (mods.hasAccessBoundary)
sym.privateWithin = typer.qualifyingClass(tree, mods.privateWithin, true)
sym
}
@@ -130,8 +130,8 @@ trait Namers { self: Analyzer =>
}
def usePrimary = sym.isTerm && (
- (sym hasFlag PARAMACCESSOR) ||
- ((sym hasFlag PARAM) && sym.owner.isPrimaryConstructor)
+ (sym.isParamAccessor) ||
+ (sym.isParameter && sym.owner.isPrimaryConstructor)
)
if (usePrimary) primaryConstructorParamNamer
@@ -152,10 +152,10 @@ trait Namers { self: Analyzer =>
private def doubleDefError(pos: Position, sym: Symbol) {
context.error(pos,
sym.name.toString() + " is already defined as " +
- (if (sym.hasFlag(SYNTHETIC))
+ (if (sym.isSynthetic)
"(compiler-generated) "+ (if (sym.isModule) "case class companion " else "")
else "") +
- (if (sym.hasFlag(CASE)) "case class " + sym.name else sym.toString()))
+ (if (sym.isCase) "case class " + sym.name else sym.toString()))
}
private def inCurrentScope(m: Symbol): Boolean = {
@@ -232,7 +232,7 @@ trait Namers { self: Analyzer =>
var m: Symbol = context.scope.lookup(tree.name)
val moduleFlags = tree.mods.flags | MODULE | FINAL
if (m.isModule && !m.isPackage && inCurrentScope(m) &&
- (currentRun.canRedefine(m) || (m hasFlag SYNTHETIC))) {
+ (currentRun.canRedefine(m) || m.isSynthetic)) {
updatePosFlags(m, tree.pos, moduleFlags)
setPrivateWithin(tree, m, tree.mods)
if (m.moduleClass != NoSymbol)
@@ -260,7 +260,7 @@ trait Namers { self: Analyzer =>
var namer : Namer = this
for (tree <- trees) {
val txt = namer.enterSym(tree)
- if (!(txt eq namer.context)) namer = newNamer(txt)
+ if (txt ne namer.context) namer = newNamer(txt)
}
namer
}
@@ -319,8 +319,8 @@ trait Namers { self: Analyzer =>
if (sym.name == nme.copy || isCopyGetter(sym)) {
// it could be a compiler-generated copy method or one of its default getters
setInfo(sym)(mkTypeCompleter(tree)(copySym => {
- def copyIsSynthetic() = sym.owner.info.member(nme.copy).hasFlag(SYNTHETIC)
- if (sym.hasFlag(SYNTHETIC) && (!sym.hasFlag(DEFAULTPARAM) || copyIsSynthetic())) {
+ def copyIsSynthetic() = sym.owner.info.member(nme.copy).isSynthetic
+ if (sym.isSynthetic && (!sym.hasDefaultFlag || copyIsSynthetic())) {
// the 'copy' method of case classes needs a special type completer to make bug0054.scala (and others)
// work. the copy method has to take exactly the same parameter types as the primary constructor.
val constrType = copySym.owner.primaryConstructor.tpe
@@ -362,10 +362,10 @@ trait Namers { self: Analyzer =>
val m = ensureCompanionObject(tree, caseModuleDef(tree))
caseClassOfModuleClass(m.moduleClass) = tree
}
- val hasDefault = impl.body flatMap {
- case DefDef(_, nme.CONSTRUCTOR, _, vparamss, _, _) => vparamss.flatten
- case _ => Nil
- } exists (_.mods hasFlag DEFAULTPARAM)
+ val hasDefault = impl.body exists {
+ case DefDef(_, nme.CONSTRUCTOR, _, vparamss, _, _) => vparamss.flatten exists (_.mods.hasDefault)
+ case _ => false
+ }
if (hasDefault) {
val m = ensureCompanionObject(tree, companionModuleDef(tree))
@@ -378,7 +378,7 @@ trait Namers { self: Analyzer =>
case vd @ ValDef(mods, name, tp, rhs) =>
if ((!context.owner.isClass ||
- (mods.flags & (PRIVATE | LOCAL | CASEACCESSOR)) == (PRIVATE | LOCAL) ||
+ (mods.isPrivateLocal && !mods.isCaseAccessor) ||
name.startsWith(nme.OUTER) ||
context.unit.isJava) &&
!mods.isLazy) {
@@ -388,7 +388,7 @@ trait Namers { self: Analyzer =>
finish
} else {
val mods1 =
- if (mods.hasFlag(PRIVATE) && mods.hasFlag(LOCAL) && !mods.isLazy) {
+ if (mods.isPrivateLocal && !mods.isLazy) {
context.error(tree.pos, "private[this] not allowed for case class parameters")
mods &~ LOCAL
} else mods
@@ -413,7 +413,7 @@ trait Namers { self: Analyzer =>
owner.newValue(tree.pos, name + "$lzy" ).setFlag((mods1.flags | MUTABLE) & ~IMPLICIT)
} else {
val mFlag = if (mods1.isLazy) MUTABLE else 0
- val lFlag = if (mods.hasFlag(PRIVATE) && mods.hasFlag(LOCAL)) 0 else LOCAL
+ val lFlag = if (mods.isPrivateLocal) 0 else LOCAL
val newflags = mods1.flags & FieldFlags | PRIVATE | lFlag | mFlag
owner.newValue(tree.pos, nme.getterToLocal(name)) setFlag newflags
}
@@ -446,7 +446,7 @@ trait Namers { self: Analyzer =>
case imp @ Import(_, _) =>
tree.symbol = NoSymbol.newImport(tree.pos)
setInfo(sym)(namerOf(sym).typeCompleter(tree))
- return (context.makeNewImport(imp))
+ return context.makeNewImport(imp)
case _ =>
}
}
@@ -507,7 +507,7 @@ trait Namers { self: Analyzer =>
else Select(This(getter.owner.name), name)) }
enterSyntheticSym(beanGetterDef)
- if (mods hasFlag MUTABLE) {
+ if (mods.isMutable) {
// can't use "enterSyntheticSym", because the parameter type is not yet
// known. instead, uses the same machinery as for the non-bean setter:
// create and enter the symbol here, add the tree in Typer.addGettterSetter.
@@ -537,7 +537,7 @@ trait Namers { self: Analyzer =>
case _ =>
}
sym.setInfo(tp)
- if ((sym.isAliasType || sym.isAbstractType) && !(sym hasFlag PARAM) &&
+ if ((sym.isAliasType || sym.isAbstractType) && !sym.isParameter &&
!typer.checkNonCyclic(tree.pos, tp))
sym.setInfo(ErrorType) // this early test is there to avoid infinite baseTypes when
// adding setters and getters --> bug798
@@ -613,7 +613,7 @@ trait Namers { self: Analyzer =>
}
val tpe1 = tpe.deconst
val tpe2 = tpe1.widen
- if ((sym.isVariable || sym.isMethod && !(sym hasFlag ACCESSOR)))
+ if ((sym.isVariable || sym.isMethod && !sym.hasAccessorFlag))
if (tpe2 <:< pt) tpe2 else tpe1
else if (isHidden(tpe)) tpe2
else if (sym.isFinal || sym.isLocal) tpe
@@ -751,7 +751,7 @@ trait Namers { self: Analyzer =>
// here, clazz is the ClassSymbol of the case class (not the module).
// @check: this seems to work only if the type completer of the class runs before the one of the
// module class: the one from the module class removes the entry form caseClassOfModuleClass (see above).
- if (clazz.isClass && !clazz.hasFlag(MODULE)) {
+ if (clazz.isClass && !clazz.hasModuleFlag) {
Namers.this.caseClassOfModuleClass get companionModuleOf(clazz, context).moduleClass map { cdef =>
def hasCopy(decls: Scope) = (decls lookup nme.copy) != NoSymbol
if (!hasCopy(decls) &&
@@ -865,7 +865,7 @@ trait Namers { self: Analyzer =>
for (vparams <- vparamss; vparam <- vparams)
if (vparam.tpt.isEmpty) vparam.symbol setInfo WildcardType
val overridden = overriddenSymbol
- if (overridden != NoSymbol && !(overridden hasFlag OVERLOADED)) {
+ if (overridden != NoSymbol && !overridden.isOverloaded) {
overridden.cookJavaRawInfo() // #3404 xform java rawtypes into existentials
resultPt = site.memberType(overridden) match {
case PolyType(tparams, rt) => rt.substSym(tparams, tparamSyms)
@@ -919,7 +919,7 @@ trait Namers { self: Analyzer =>
tpt.tpe
} else typer.typedType(tpt).tpe
// #2382: return type of default getters are always @uncheckedVariance
- if (meth.hasFlag(DEFAULTPARAM))
+ if (meth.hasDefaultFlag)
rt.withAnnotation(AnnotationInfo(definitions.uncheckedVarianceClass.tpe, List(), List()))
else rt
})
@@ -938,7 +938,7 @@ trait Namers { self: Analyzer =>
val isConstr = meth.isConstructor
val overridden = if (isConstr || !meth.owner.isClass) NoSymbol
else overriddenSymbol
- val overrides = overridden != NoSymbol && !(overridden hasFlag OVERLOADED)
+ val overrides = overridden != NoSymbol && !overridden.isOverloaded
// value parameters of the base class (whose defaults might be overridden)
var baseParamss = overridden.tpe.paramss
// match empty and missing parameter list
@@ -961,8 +961,8 @@ trait Namers { self: Analyzer =>
for (vparam <- vparams) {
val sym = vparam.symbol
// true if the corresponding parameter of the base class has a default argument
- val baseHasDefault = overrides && (baseParams.head hasFlag DEFAULTPARAM)
- if (sym hasFlag DEFAULTPARAM) {
+ val baseHasDefault = overrides && baseParams.head.hasDefaultFlag
+ if (sym.hasDefaultFlag) {
// generate a default getter for that argument
val oflag = if (baseHasDefault) OVERRIDE else 0
val name = nme.defaultGetterName(meth.name, posCounter)
@@ -1151,7 +1151,7 @@ trait Namers { self: Analyzer =>
newNamer(context.makeNewScope(tree, sym)).methodSig(mods, tparams, vparamss, tpt, rhs)
case vdef @ ValDef(mods, name, tpt, rhs) =>
- val typer1 = typer.constrTyperIf(sym.hasFlag(PARAM | PRESUPER) && !mods.hasFlag(JAVA) && sym.owner.isConstructor)
+ val typer1 = typer.constrTyperIf(sym.hasFlag(PARAM | PRESUPER) && !mods.isJavaDefined && sym.owner.isConstructor)
if (tpt.isEmpty) {
if (rhs.isEmpty) {
context.error(tpt.pos, "missing parameter type");
@@ -1175,7 +1175,7 @@ trait Namers { self: Analyzer =>
typer.checkStable(expr1)
if ((expr1.symbol ne null) && expr1.symbol.isRootPackage) context.error(tree.pos, "_root_ cannot be imported")
def checkNotRedundant(pos: Position, from: Name, to: Name): Boolean = {
- if (!tree.symbol.hasFlag(SYNTHETIC) &&
+ if (!tree.symbol.isSynthetic &&
!((expr1.symbol ne null) && expr1.symbol.isInterpreterWrapper) &&
base.member(from) != NoSymbol) {
val e = context.scope.lookupEntry(to)
@@ -1290,10 +1290,10 @@ trait Namers { self: Analyzer =>
context.error(sym.pos, "`override' modifier not allowed for constructors")
if (sym.hasFlag(ABSOVERRIDE) && !sym.owner.isTrait)
context.error(sym.pos, "`abstract override' modifier only allowed for members of traits")
- if (sym.hasFlag(LAZY) && sym.hasFlag(PRESUPER))
+ if (sym.isLazy && sym.hasFlag(PRESUPER))
context.error(sym.pos, "`lazy' definitions may not be initialized early")
if (sym.info.typeSymbol == FunctionClass(0) &&
- sym.isValueParameter && sym.owner.isClass && sym.owner.hasFlag(CASE))
+ sym.isValueParameter && sym.owner.isCaseClass)
context.error(sym.pos, "pass-by-name arguments not allowed for case class parameters")
if (sym hasFlag DEFERRED) { // virtual classes count, too
if (sym.hasAnnotation(definitions.NativeAttr))
@@ -1314,6 +1314,10 @@ trait Namers { self: Analyzer =>
/* checkNoConflict(PRIVATE, FINAL) // can't do this because FINAL also means compile-time constant */
checkNoConflict(ABSTRACT, FINAL) // bug #1833
checkNoConflict(DEFERRED, FINAL)
+
+ // @PP: I added this as a sanity check because these flags are supposed to be
+ // converted to ABSOVERRIDE before arriving here.
+ checkNoConflict(ABSTRACT, OVERRIDE)
}
}
@@ -1343,7 +1347,7 @@ trait Namers { self: Analyzer =>
* of the actual declaration or definition, not in terms of the generated setters
* and getters */
def underlying(member: Symbol): Symbol =
- if (member hasFlag ACCESSOR) {
+ if (member.hasAccessorFlag) {
if (member.isDeferred) {
val getter = if (member.isSetter) member.getter(member.owner) else member
val result = getter.owner.newValue(getter.pos, getter.name)
@@ -1363,7 +1367,7 @@ trait Namers { self: Analyzer =>
var res = clazz.companionModule
if (res == NoSymbol)
res = context.lookup(clazz.name.toTermName, clazz.owner).suchThat(sym =>
- sym.hasFlag(MODULE) && sym.isCoDefinedWith(clazz))
+ sym.hasModuleFlag && sym.isCoDefinedWith(clazz))
res
} catch {
case e: InvalidCompanions =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
index 808dbcc785..04c6dbe4a0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
@@ -364,7 +364,7 @@ trait NamesDefaults { self: Analyzer =>
pos: util.Position, context: Context): (List[Tree], List[Symbol]) = {
if (givenArgs.length < params.length) {
val (missing, positional) = missingParams(givenArgs, params)
- if (missing forall (_.hasFlag(DEFAULTPARAM))) {
+ if (missing forall (_.hasDefaultFlag)) {
val defaultArgs = missing map (p => {
var default1 = qual match {
case Some(q) => gen.mkAttributedSelect(q.duplicate, defaultGetter(p, context))
@@ -380,7 +380,7 @@ trait NamesDefaults { self: Analyzer =>
}
})
(givenArgs ::: defaultArgs, Nil)
- } else (givenArgs, missing filter (! _.hasFlag(DEFAULTPARAM)))
+ } else (givenArgs, missing filterNot (_.hasDefaultFlag))
} else (givenArgs, Nil)
}
@@ -453,7 +453,7 @@ trait NamesDefaults { self: Analyzer =>
val udp = typer.context.extractUndetparams()
val subst = new SubstTypeMap(udp, udp map (_ => WildcardType)) {
override def apply(tp: Type): Type = tp match {
- case TypeRef(_, sym, List(arg)) if (sym == ByNameParamClass) => super.apply(arg)
+ case TypeRef(_, ByNameParamClass, List(arg)) => super.apply(arg)
case _ => super.apply(tp)
}
}
@@ -515,7 +515,7 @@ trait NamesDefaults { self: Analyzer =>
var rest = params
while (!rest.isEmpty) {
val p = rest.head
- if (!p.hasFlag(SYNTHETIC)) {
+ if (!p.isSynthetic) {
if (p.name == name) return (i, None)
if (deprecatedName(p) == Some(name)) return (i, Some(p.name))
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 17048f691a..5c6c3a846f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -99,10 +99,10 @@ abstract class RefChecks extends InfoTransform {
private def checkDefaultsInOverloaded(clazz: Symbol) {
def check(members: List[Symbol]): Unit = members match {
case x :: xs =>
- if (x.paramss.exists(_.exists(p => p.hasFlag(DEFAULTPARAM))) && !nme.isProtectedAccessor(x.name)) {
+ if ((x hasParamWhich (_.hasDefaultFlag)) && !nme.isProtectedAccessor(x.name)) {
val others = xs.filter(alt => {
alt.name == x.name &&
- alt.paramss.exists(_.exists(_.hasFlag(DEFAULTPARAM))) &&
+ (alt hasParamWhich (_.hasDefaultFlag)) &&
(!alt.isConstructor || alt.owner == x.owner) // constructors of different classes are allowed to have defaults
})
if (!others.isEmpty) {
@@ -281,8 +281,10 @@ abstract class RefChecks extends InfoTransform {
}
}
- def accessFlagsToString(sym: Symbol)
- = flagsToString(sym getFlag (PRIVATE | PROTECTED), if (!sym.hasAccessBoundary) "" else sym.privateWithin.name.toString)
+ def accessFlagsToString(sym: Symbol) = flagsToString(
+ sym getFlag (PRIVATE | PROTECTED),
+ if (sym.hasAccessBoundary) "" + sym.privateWithin.name else ""
+ )
def overrideAccessError() {
val otherAccess = accessFlagsToString(other)
@@ -344,7 +346,7 @@ abstract class RefChecks extends InfoTransform {
} else if ((other hasFlag ABSOVERRIDE) && other.isIncompleteIn(clazz) && !(member hasFlag ABSOVERRIDE)) {
overrideError("needs `abstract override' modifiers")
} else if ((member hasFlag (OVERRIDE | ABSOVERRIDE)) &&
- (other hasFlag ACCESSOR) && other.accessed.isVariable && !other.accessed.hasFlag(LAZY)) {
+ (other hasFlag ACCESSOR) && other.accessed.isVariable && !other.accessed.isLazy) {
overrideError("cannot override a mutable variable")
} else if ((member hasFlag (OVERRIDE | ABSOVERRIDE)) &&
!(member.owner.thisType.baseClasses exists (_ isSubClass other.owner)) &&
@@ -681,7 +683,7 @@ abstract class RefChecks extends InfoTransform {
// Flip occurrences of type parameters and parameters, unless
// - it's a constructor, or case class factory or extractor
// - it's a type parameter of tvar's owner.
- if ((sym hasFlag PARAM) && !sym.owner.isConstructor && !sym.owner.isCaseApplyOrUnapply &&
+ if (sym.isParameter && !sym.owner.isConstructor && !sym.owner.isCaseApplyOrUnapply &&
!(tvar.isTypeParameterOrSkolem && sym.isTypeParameterOrSkolem &&
tvar.owner == sym.owner)) state = -state;
else if (!sym.owner.isClass ||
@@ -1078,7 +1080,7 @@ abstract class RefChecks extends InfoTransform {
case Apply(_, args) =>
val clazz = pat.tpe.typeSymbol;
clazz == seltpe.typeSymbol &&
- clazz.isClass && (clazz hasFlag CASE) &&
+ clazz.isCaseClass &&
(args corresponds clazz.primaryConstructor.tpe.asSeenFrom(seltpe, clazz).paramTypes)(isIrrefutable) // @PP: corresponds
case Typed(pat, tpt) =>
seltpe <:< tpt.tpe
@@ -1138,7 +1140,7 @@ abstract class RefChecks extends InfoTransform {
private def checkTypeRef(tp: Type, pos: Position) = tp match {
case TypeRef(pre, sym, args) =>
checkDeprecated(sym, pos)
- if(sym.hasFlag(JAVA))
+ if(sym.isJavaDefined)
sym.typeParams foreach (_.cookJavaRawInfo())
if (!tp.isHigherKinded)
checkBounds(pre, sym.owner, sym.typeParams, args, pos)
@@ -1239,7 +1241,7 @@ abstract class RefChecks extends InfoTransform {
if (settings.Xmigration28.value)
checkMigration(sym, tree.pos)
- if (currentClass != sym.owner && (sym hasFlag LOCAL)) {
+ if (currentClass != sym.owner && sym.hasLocalFlag) {
var o = currentClass
var hidden = false
while (!hidden && o != sym.owner && o != sym.owner.moduleClass && !o.isPackage) {
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 717b4e672e..7f8359fb94 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -194,8 +194,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
mayNeedProtectedAccessor(sel, args, false)
case sel @ Select(qual @ This(_), name) =>
- if ((sym hasFlag PARAMACCESSOR)
- && (sym.alias != NoSymbol)) {
+ if (sym.isParamAccessor && sym.alias != NoSymbol) {
val result = localTyper.typed {
Select(
Super(qual.symbol, nme.EMPTY.toTypeName/*qual.symbol.info.parents.head.symbol.name*/) setPos qual.pos,
@@ -208,9 +207,9 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
else mayNeedProtectedAccessor(sel, List(EmptyTree), false)
case Select(sup @ Super(_, mix), name) =>
- if (sym.isValue && !sym.isMethod || sym.hasFlag(ACCESSOR)) {
+ if (sym.isValue && !sym.isMethod || sym.hasAccessorFlag) {
unit.error(tree.pos, "super may be not be used on "+
- (if (sym.hasFlag(ACCESSOR)) sym.accessed else sym))
+ (if (sym.hasAccessorFlag) sym.accessed else sym))
}
else if (isDisallowed(sym)) {
unit.error(tree.pos, "super not allowed here: use this." + name.decode + " instead")
@@ -225,7 +224,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
case Assign(lhs @ Select(qual, name), rhs) =>
if (lhs.symbol.isVariable &&
- lhs.symbol.hasFlag(JAVA) &&
+ lhs.symbol.isJavaDefined &&
needsProtectedAccessor(lhs.symbol, tree.pos)) {
if (settings.debug.value) log("Adding protected setter for " + tree)
val setter = makeSetter(lhs);
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 61894092f3..545aab4c79 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -234,8 +234,7 @@ trait SyntheticMethods extends ast.TreeDSL {
// only nested objects inside objects should get readResolve automatically
// otherwise after de-serialization we get null references for lazy accessors (nested object -> lazy val + class def)
// since the bitmap gets serialized but the moduleVar not
- clazz.isSerializable &&
- ((!clazz.owner.isPackageClass && clazz.owner.isModuleClass) || clazz.owner.isPackageClass)
+ clazz.isSerializable && (clazz.owner.isPackageClass || clazz.owner.isModuleClass)
)
// A buffer collecting additional methods for the template body
diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
index 16961db77b..2042b08d83 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
@@ -211,7 +211,7 @@ abstract class TreeCheckers extends Analyzer {
tree match {
case DefDef(_, _, _, _, _, _) =>
- if (sym.isGetterOrSetter && !sym.isDeferred) {
+ if (sym.hasAccessorFlag && !sym.isDeferred) {
sym.tpe.resultType match {
case _: ConstantType => ()
case _ =>
@@ -239,7 +239,7 @@ abstract class TreeCheckers extends Analyzer {
checkSym(tree)
case This(_) =>
checkSym(tree)
- if (sym.isStatic && (sym hasFlag MODULE)) ()
+ if (sym.isStatic && sym.hasModuleFlag) ()
else if (currentOwner.ownerChain takeWhile (_ != sym) exists (_ == NoSymbol))
return fail("tree symbol "+sym+" does not point to enclosing class; tree = ")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index d87cd571d8..ceae787b1d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -211,7 +211,7 @@ trait Typers { self: Analyzer =>
argBuff += mkArg(res.tree, param.name)
} else {
mkArg = mkNamedArg // don't pass the default argument (if any) here, but start emitting named arguments for the following args
- if (!param.hasFlag(DEFAULTPARAM))
+ if (!param.hasDefault)
context.error(fun.pos, errorMessage(param.name, param.tpe))
/* else {
TODO: alternative (to expose implicit search failure more) -->
@@ -444,7 +444,7 @@ trait Typers { self: Analyzer =>
else if (!phase.erasedTypes) { // privates
val badSymbol = hiddenSymbols.head
error(tree.pos,
- (if (badSymbol hasFlag PRIVATE) "private " else "") + badSymbol +
+ (if (badSymbol.isPrivate) "private " else "") + badSymbol +
" escapes its defining scope as part of type "+tree.tpe)
setError(tree)
} else tree
@@ -455,7 +455,7 @@ trait Typers { self: Analyzer =>
override def apply(t: Type): Type = {
def checkNoEscape(sym: Symbol) {
- if (sym.hasFlag(PRIVATE) && !sym.hasFlag(SYNTHETIC_PRIVATE)) {
+ if (sym.isPrivate && !sym.hasFlag(SYNTHETIC_PRIVATE)) {
var o = owner
while (o != NoSymbol && o != sym.owner &&
!o.isLocal && !o.hasFlag(PRIVATE) &&
@@ -636,7 +636,7 @@ trait Typers { self: Analyzer =>
* </ol>
*/
private def stabilize(tree: Tree, pre: Type, mode: Int, pt: Type): Tree = {
- if (tree.symbol.hasFlag(OVERLOADED) && (mode & FUNmode) == 0)
+ if (tree.symbol.isOverloaded && (mode & FUNmode) == 0)
inferExprAlternative(tree, pt)
val sym = tree.symbol
@@ -890,9 +890,9 @@ trait Typers { self: Analyzer =>
if ((mode & FUNmode) != 0) {
tree
} else if (tree.hasSymbol && !tree.symbol.typeParams.isEmpty && (mode & HKmode) == 0 &&
- !(tree.symbol.hasFlag(JAVA) && context.unit.isJava)) { // (7)
+ !(tree.symbol.isJavaDefined && context.unit.isJava)) { // (7)
// @M When not typing a higher-kinded type ((mode & HKmode) == 0)
- // or raw type (tree.symbol.hasFlag(JAVA) && context.unit.isJava), types must be of kind *,
+ // or raw type (tree.symbol.isJavaDefined && context.unit.isJava), types must be of kind *,
// and thus parameterized types must be applied to their type arguments
// @M TODO: why do kind-* tree's have symbols, while higher-kinded ones don't?
errorTree(tree, tree.symbol+" takes type parameters")
@@ -925,7 +925,7 @@ trait Typers { self: Analyzer =>
val unapply = unapplyMember(extractor.tpe)
val clazz = unapplyParameterType(unapply)
- if ((unapply hasFlag CASE) && (clazz hasFlag CASE) && !(clazz.ancestors exists (_ hasFlag CASE))) {
+ if (unapply.isCase && clazz.isCase && !(clazz.ancestors exists (_.isCase))) {
if (!phase.erasedTypes) checkStable(tree) // todo: do we need to demand this?
// convert synthetic unapply of case class to case class constructor
val prefix = tree.tpe.prefix
@@ -1098,7 +1098,7 @@ trait Typers { self: Analyzer =>
// "change your code now!" as there are material bugs (which are very unlikely
// to be fixed) associated with case class inheritance.
if (!phase.erasedTypes) {
- for (ancestor <- clazz.ancestors find (_ hasFlag CASE))
+ for (ancestor <- clazz.ancestors find (_.isCase))
unit.deprecationWarning(clazz.pos, (
"case class `%s' has case class ancestor `%s'. This has been deprecated " +
"for unduly complicating both usage and implementation. You should instead " +
@@ -1230,7 +1230,7 @@ trait Typers { self: Analyzer =>
error(parent.pos, psym+" needs to be a trait to be mixed in")
}
}
- if (psym hasFlag FINAL) {
+ if (psym.isFinal) {
error(parent.pos, "illegal inheritance from final "+psym)
}
if (psym.isSealed && !phase.erasedTypes) {
@@ -1241,7 +1241,7 @@ trait Typers { self: Analyzer =>
}
if (!(selfType <:< parent.tpe.typeOfThis) &&
!phase.erasedTypes &&
- !(context.owner hasFlag SYNTHETIC) && // don't do this check for synthetic concrete classes for virtuals (part of DEVIRTUALIZE)
+ !context.owner.isSynthetic && // don't do this check for synthetic concrete classes for virtuals (part of DEVIRTUALIZE)
!(settings.suppressVTWarn.value) &&
!selfType.isErroneous && !parent.tpe.isErroneous)
{
@@ -1350,7 +1350,7 @@ trait Typers { self: Analyzer =>
if (mdef.name == nme.PACKAGEkw)
for (m <- mdef.symbol.info.members)
- if (m.isClass && m.hasFlag(CASE))
+ if (m.isCaseClass)
context.error(if (m.pos.isDefined) m.pos else mdef.pos,
"implementation restriction: "+mdef.symbol+" cannot contain case "+m)
treeCopy.ModuleDef(mdef, typedMods, mdef.name, impl2) setType NoType
@@ -1370,23 +1370,22 @@ trait Typers { self: Analyzer =>
def addGetterSetter(stat: Tree): List[Tree] = stat match {
case ValDef(mods, name, tpt, rhs)
// PRIVATE | LOCAL are fields generated for primary constructor arguments
- if (mods.flags & (PRIVATE | LOCAL)) != (PRIVATE | LOCAL).toLong && !stat.symbol.isModuleVar =>
-
- val isDeferred = mods hasFlag DEFERRED
+ if !mods.isPrivateLocal && !stat.symbol.isModuleVar =>
+ val isDeferred = mods.isDeferred
val value = stat.symbol
val allAnnots = value.annotations
if (!isDeferred)
// keepClean: by default annotations go to the field, except if the field is
// generated for a class parameter (PARAMACCESSOR).
- value.setAnnotations(memberAnnots(allAnnots, FieldTargetClass, keepClean = !mods.hasFlag(PARAMACCESSOR)))
+ value.setAnnotations(memberAnnots(allAnnots, FieldTargetClass, keepClean = !mods.isParamAccessor))
val getter = if (isDeferred) value else value.getter(value.owner)
assert(getter != NoSymbol, stat)
- if (getter hasFlag OVERLOADED)
+ if (getter.isOverloaded)
error(getter.pos, getter+" is defined twice")
getter.setAnnotations(memberAnnots(allAnnots, GetterTargetClass))
- if (value.hasFlag(LAZY)) List(stat)
+ if (value.isLazy) List(stat)
else {
val vdef = treeCopy.ValDef(stat, mods | PRIVATE | LOCAL, nme.getterToLocal(name), tpt, rhs)
val getterDef: DefDef = atPos(vdef.pos.focus) {
@@ -1418,7 +1417,7 @@ trait Typers { self: Analyzer =>
val gs = new ListBuffer[DefDef]
gs.append(getterDef)
- if (mods hasFlag MUTABLE) {
+ if (mods.isMutable) {
val setter = getter.setter(value.owner)
gs.append(setterDef(setter))
}
@@ -1435,14 +1434,14 @@ trait Typers { self: Analyzer =>
unit.error(stat.pos, "implementation limitation: the BeanProperty annotation cannot be used in a type alias or renamed import")
}
beanGetter.setAnnotations(memberAnnots(allAnnots, BeanGetterTargetClass))
- if (mods.hasFlag(MUTABLE) && beanGetter != NoSymbol) {
+ if (mods.isMutable && beanGetter != NoSymbol) {
val beanSetterName = "set" + nameSuffix
val beanSetter = value.owner.info.decl(beanSetterName)
// unlike for the beanGetter, the beanSetter body is generated here. see comment in Namers.
gs.append(setterDef(beanSetter, isBean = true))
}
}
- if (mods hasFlag DEFERRED) gs.toList else vdef :: gs.toList
+ if (mods.isDeferred) gs.toList else vdef :: gs.toList
}
case dd @ DocDef(comment, defn) =>
addGetterSetter(defn) map (stat => DocDef(comment, stat) setPos dd.pos)
@@ -1532,7 +1531,7 @@ trait Typers { self: Analyzer =>
assert(clazz.info.decls != EmptyScope)
enterSyms(context.outer.make(templ, clazz, clazz.info.decls), templ.body)
validateParentClasses(parents1, selfType)
- if (clazz hasFlag CASE)
+ if (clazz.isCase)
validateNoCaseAncestor(clazz)
if ((clazz isSubClass ClassfileAnnotationClass) && !clazz.owner.isPackageClass)
@@ -1560,7 +1559,7 @@ trait Typers { self: Analyzer =>
def typedValDef(vdef: ValDef): ValDef = {
// attributes(vdef)
val sym = vdef.symbol
- val typer1 = constrTyperIf(sym.hasFlag(PARAM) && sym.owner.isConstructor)
+ val typer1 = constrTyperIf(sym.isParameter && sym.owner.isConstructor)
val typedMods = removeAnnotations(vdef.mods)
// complete lazy annotations
@@ -1569,9 +1568,9 @@ trait Typers { self: Analyzer =>
var tpt1 = checkNoEscaping.privates(sym, typer1.typedType(vdef.tpt))
checkNonCyclic(vdef, tpt1)
if (sym.hasAnnotation(definitions.VolatileAttr)) {
- if (!sym.hasFlag(MUTABLE))
+ if (!sym.isMutable)
error(vdef.pos, "values cannot be volatile")
- else if (sym.hasFlag(FINAL))
+ else if (sym.isFinal)
error(vdef.pos, "final vars cannot be volatile")
}
val rhs1 =
@@ -1580,7 +1579,7 @@ trait Typers { self: Analyzer =>
error(vdef.pos, "local variables must be initialized")
vdef.rhs
} else {
- val tpt2 = if (sym hasFlag DEFAULTPARAM) {
+ val tpt2 = if (sym.hasDefault) {
// When typechecking default parameter, replace all type parameters in the expected type by Wildcard.
// This allows defining "def foo[T](a: T = 1)"
val tparams =
@@ -1638,7 +1637,7 @@ trait Typers { self: Analyzer =>
if (superConstr.symbol.isPrimaryConstructor) {
val superClazz = superConstr.symbol.owner
- if (!superClazz.hasFlag(JAVA)) {
+ if (!superClazz.isJavaDefined) {
val superParamAccessors = superClazz.constrParamAccessors
if (superParamAccessors.length == superArgs.length) {
(superParamAccessors, superArgs).zipped map { (superAcc, superArg) =>
@@ -1652,7 +1651,7 @@ trait Typers { self: Analyzer =>
superClazz.info.nonPrivateMember(alias.name) != alias)
alias = NoSymbol
if (alias != NoSymbol) {
- var ownAcc = clazz.info.decl(name).suchThat(_.hasFlag(PARAMACCESSOR))
+ var ownAcc = clazz.info.decl(name).suchThat(_.isParamAccessor)
if ((ownAcc hasFlag ACCESSOR) && !ownAcc.isDeferred)
ownAcc = ownAcc.accessed
if (!ownAcc.isVariable && !alias.accessed.isVariable) {
@@ -1678,7 +1677,7 @@ trait Typers { self: Analyzer =>
* - a type member of the structural type
* - an abstract type declared outside of the structural type. */
def checkMethodStructuralCompatible(meth: Symbol): Unit =
- if (meth.owner.isStructuralRefinement && meth.allOverriddenSymbols.isEmpty && (!meth.hasFlag(PRIVATE) && meth.privateWithin == NoSymbol)) {
+ if (meth.owner.isStructuralRefinement && meth.allOverriddenSymbols.isEmpty && !(meth.isPrivate || meth.hasAccessBoundary)) {
val tp: Type = meth.tpe match {
case mt: MethodType => mt
case pt: PolyType => pt.resultType
@@ -1774,7 +1773,7 @@ trait Typers { self: Analyzer =>
ddef.tpt.setType(tpt1.tpe)
val typedMods = removeAnnotations(ddef.mods)
var rhs1 =
- if (ddef.name == nme.CONSTRUCTOR && !ddef.symbol.hasFlag(STATIC)) { // need this to make it possible to generate static ctors
+ if (ddef.name == nme.CONSTRUCTOR && !ddef.symbol.hasStaticFlag) { // need this to make it possible to generate static ctors
if (!meth.isPrimaryConstructor &&
(!meth.owner.isClass ||
meth.owner.isModuleClass ||
@@ -1792,7 +1791,7 @@ trait Typers { self: Analyzer =>
if (tpt1.tpe.typeSymbol != NothingClass && !context.returnsSeen) rhs1 = checkDead(rhs1)
if (phase.id <= currentRun.typerPhase.id && meth.owner.isClass &&
- meth.paramss.exists(ps => ps.exists(_.hasFlag(DEFAULTPARAM)) && isRepeatedParamType(ps.last.tpe)))
+ meth.paramss.exists(ps => ps.exists(_.hasDefaultFlag) && isRepeatedParamType(ps.last.tpe)))
error(meth.pos, "a parameter section with a `*'-parameter is not allowed to have default arguments")
if (phase.id <= currentRun.typerPhase.id) {
@@ -1935,7 +1934,7 @@ trait Typers { self: Analyzer =>
for (member <- classDef.symbol.info.decls.toList
if member.isTerm && !member.isConstructor &&
member.allOverriddenSymbols.isEmpty &&
- (!member.hasFlag(PRIVATE) && member.privateWithin == NoSymbol) &&
+ (!member.isPrivate && !member.hasAccessBoundary) &&
!(visibleMembers exists { visible =>
visible.name == member.name &&
member.tpe <:< visible.tpe.substThis(visible.owner, ThisType(classDef.symbol))
@@ -2048,7 +2047,7 @@ trait Typers { self: Analyzer =>
error(
vparam.pos,
"missing parameter type"+
- (if (vparam.mods.hasFlag(SYNTHETIC)) " for expanded function "+fun
+ (if (vparam.mods.isSynthetic) " for expanded function "+fun
else ""))
ErrorType
}
@@ -2132,10 +2131,12 @@ trait Typers { self: Analyzer =>
}
}
- def accesses(accessor: Symbol, accessed: Symbol) =
- (accessed hasFlag LOCAL) && (accessed hasFlag PARAMACCESSOR) ||
- (accessor hasFlag ACCESSOR) &&
- !(accessed hasFlag ACCESSOR) && accessed.isPrivateLocal
+ /** 'accessor' and 'accessed' are so similar it becomes very difficult to
+ * follow the logic, so I renamed one to something distinct.
+ */
+ def accesses(looker: Symbol, accessed: Symbol) = accessed.hasLocalFlag && (
+ accessed.isParamAccessor || (looker.hasAccessorFlag && !accessed.hasAccessorFlag && accessed.isPrivate)
+ )
def checkNoDoubleDefsAndAddSynthetics(stats: List[Tree]): List[Tree] = {
val scope = if (inBlock) context.scope else context.owner.info.decls
@@ -2155,7 +2156,7 @@ trait Typers { self: Analyzer =>
(e.sym.isType || inBlock || (e.sym.tpe matches e1.sym.tpe)))
// default getters are defined twice when multiple overloads have defaults. an
// error for this is issued in RefChecks.checkDefaultsInOverloaded
- if (!e.sym.isErroneous && !e1.sym.isErroneous && !e.sym.hasFlag(DEFAULTPARAM)) {
+ if (!e.sym.isErroneous && !e1.sym.isErroneous && !e.sym.hasDefaultFlag) {
error(e.sym.pos, e1.sym+" is defined twice"+
{if(!settings.debug.value) "" else " in "+unit.toString})
scope.unlink(e1) // need to unlink to avoid later problems with lub; see #2779
@@ -2165,11 +2166,9 @@ trait Typers { self: Analyzer =>
}
// add synthetics
- context.unit.synthetics get e.sym match {
- case Some(tree) =>
- newStats += typedStat(tree) // might add even more synthetics to the scope
- context.unit.synthetics -= e.sym
- case _ =>
+ context.unit.synthetics get e.sym foreach { tree =>
+ newStats += typedStat(tree) // might add even more synthetics to the scope
+ context.unit.synthetics -= e.sym
}
e = e.next
@@ -2182,7 +2181,7 @@ trait Typers { self: Analyzer =>
if (newStats.isEmpty) stats
else {
val (defaultGetters, others) = newStats.toList.partition {
- case DefDef(mods, _, _, _, _, _) => mods.hasFlag(DEFAULTPARAM)
+ case DefDef(mods, _, _, _, _, _) => mods.hasDefaultFlag
case _ => false
}
// default getters first: see #2489
@@ -2251,7 +2250,7 @@ trait Typers { self: Analyzer =>
def doTypedApply(tree: Tree, fun0: Tree, args: List[Tree], mode: Int, pt: Type): Tree = {
var fun = fun0
- if (fun.hasSymbol && (fun.symbol hasFlag OVERLOADED)) {
+ if (fun.hasSymbol && fun.symbol.isOverloaded) {
// remove alternatives with wrong number of parameters without looking at types.
// less expensive than including them in inferMethodAlternatvie (see below).
def shapeType(arg: Tree): Type = arg match {
@@ -2272,13 +2271,13 @@ trait Typers { self: Analyzer =>
// (I had expected inferMethodAlternative to pick up the slack introduced by using WildcardType here)
isApplicableSafe(context.undetparams, followApply(pre.memberType(alt)), argtypes, pt)
}
- if (sym hasFlag OVERLOADED) {
+ if (sym.isOverloaded) {
val sym1 = sym filter (alt => {
// eliminate functions that would result from tupling transforms
// keeps alternatives with repeated params
hasExactlyNumParams(followApply(alt.tpe), argtypes.length) ||
// also keep alts which define at least one default
- alt.tpe.paramss.exists(_.exists(_.hasFlag(DEFAULTPARAM)))
+ alt.tpe.paramss.exists(_.exists(_.hasDefault))
})
if (sym1 != NoSymbol) sym = sym1
}
@@ -2675,7 +2674,7 @@ trait Typers { self: Analyzer =>
if (typedFun.isErroneous) annotationError
else if (annType.typeSymbol isNonBottomSubClass ClassfileAnnotationClass) {
// annotation to be saved as java classfile annotation
- val isJava = typedFun.symbol.owner.hasFlag(JAVA)
+ val isJava = typedFun.symbol.owner.isJavaDefined
if (!annType.typeSymbol.isNonBottomSubClass(annClass)) {
error(tpt.pos, "expected annotation of type "+ annClass.tpe +", found "+ annType)
} else if (argss.length > 1) {
@@ -2686,7 +2685,7 @@ trait Typers { self: Analyzer =>
List(new AssignOrNamedArg(Ident(nme.value), argss.head.head))
else argss.head
val annScope = annType.decls
- .filter(sym => sym.isMethod && !sym.isConstructor && sym.hasFlag(JAVA))
+ .filter(sym => sym.isMethod && !sym.isConstructor && sym.isJavaDefined)
val names = new collection.mutable.HashSet[Symbol]
names ++= (if (isJava) annScope.iterator
else typedFun.tpe.params.iterator)
@@ -2713,7 +2712,7 @@ trait Typers { self: Analyzer =>
for (name <- names) {
if (!name.annotations.contains(AnnotationInfo(AnnotationDefaultAttr.tpe, List(), List())) &&
- !name.hasFlag(DEFAULTPARAM))
+ !name.hasDefaultFlag)
error(ann.pos, "annotation " + annType.typeSymbol.fullName + " is missing argument " + name.name)
}
@@ -2789,7 +2788,7 @@ trait Typers { self: Analyzer =>
}
def isRawParameter(sym: Symbol) = // is it a type parameter leaked by a raw type?
- sym.isTypeParameter && sym.owner.hasFlag(JAVA)
+ sym.isTypeParameter && sym.owner.isJavaDefined
/** Given a set `rawSyms' of term- and type-symbols, and a type `tp'.
* produce a set of fresh type parameters and a type so that it can be
@@ -2841,11 +2840,11 @@ trait Typers { self: Analyzer =>
sym.isExistentialSkolem && sym.unpackLocation == tree ||
tree.isDef && tree.symbol == sym
def isVisibleParameter(sym: Symbol) =
- (sym hasFlag PARAM) && (sym.owner == owner) && (sym.isType || !owner.isAnonymousFunction)
+ sym.isParameter && (sym.owner == owner) && (sym.isType || !owner.isAnonymousFunction)
def containsDef(owner: Symbol, sym: Symbol): Boolean =
- (!(sym hasFlag PACKAGE)) && {
+ (!sym.hasPackageFlag) && {
var o = sym.owner
- while (o != owner && o != NoSymbol && !(o hasFlag PACKAGE)) o = o.owner
+ while (o != owner && o != NoSymbol && !o.hasPackageFlag) o = o.owner
o == owner && !isVisibleParameter(sym)
}
var localSyms = collection.immutable.Set[Symbol]()
@@ -2874,7 +2873,7 @@ trait Typers { self: Analyzer =>
def addLocals(tp: Type) {
val remainingSyms = new ListBuffer[Symbol]
def addIfLocal(sym: Symbol, tp: Type) {
- if (isLocal(sym) && !localSyms.contains(sym) && !boundSyms.contains(sym)) {
+ if (isLocal(sym) && !localSyms(sym) && !boundSyms(sym)) {
if (sym.typeParams.isEmpty) {
localSyms += sym
remainingSyms += sym
@@ -3198,9 +3197,9 @@ trait Typers { self: Analyzer =>
*/
def narrowRhs(tp: Type) = { val sym = context.tree.symbol
context.tree match {
- case ValDef(mods, _, _, Apply(Select(`tree`, _), _)) if !(mods hasFlag MUTABLE) && sym != null && sym != NoSymbol =>
+ case ValDef(mods, _, _, Apply(Select(`tree`, _), _)) if !mods.isMutable && sym != null && sym != NoSymbol =>
val sym1 = if (sym.owner.isClass && sym.getter(sym.owner) != NoSymbol) sym.getter(sym.owner)
- else if ((sym hasFlag LAZY) && sym.lazyAccessor != NoSymbol) sym.lazyAccessor
+ else if (sym.isLazyAccessor) sym.lazyAccessor
else sym
val pre = if (sym1.owner.isClass) sym1.owner.thisType else NoPrefix
intersectionType(List(tp, singleType(pre, sym1)))
@@ -3209,7 +3208,7 @@ trait Typers { self: Analyzer =>
val tp = tpt1.tpe
val sym = tp.typeSymbol
- if (sym.isAbstractType || (sym hasFlag ABSTRACT))
+ if (sym.isAbstractType || sym.hasAbstractFlag)
error(tree.pos, sym + " is abstract; cannot be instantiated")
else if (!( tp == sym.initialize.thisSym.tpe // when there's no explicit self type -- with (#3612) or without self variable
// sym.thisSym.tpe == tp.typeOfThis (except for objects)
@@ -3544,7 +3543,7 @@ trait Typers { self: Analyzer =>
}
if (!reallyExists(sym)) {
- if (context.owner.toplevelClass.hasFlag(JAVA) && name.isTypeName) {
+ if (context.owner.toplevelClass.isJavaDefined && name.isTypeName) {
val tree1 = atPos(tree.pos) { gen.convertToSelectFromType(qual, name) }
if (tree1 != EmptyTree) return typed1(tree1, mode, pt)
}
diff --git a/src/library/scala/reflect/generic/HasFlags.scala b/src/library/scala/reflect/generic/HasFlags.scala
index 9ce91ce197..2f635fbd79 100644
--- a/src/library/scala/reflect/generic/HasFlags.scala
+++ b/src/library/scala/reflect/generic/HasFlags.scala
@@ -26,7 +26,7 @@ package generic
final def isModuleVar: Boolean = isVariable && hasFlag(MODULEVAR)
final def isStable =
isTerm &&
- !hasFlag(MUTABLE) &&
+ !hasTraitFlag &&
(!hasFlag(METHOD | BYNAMEPARAM) || hasFlag(STABLE)) &&
!(tpe.isVolatile && !hasAnnotation(uncheckedStableClass))
final def isStatic: Boolean =
@@ -178,8 +178,10 @@ trait HasFlags {
def isDefaultInit = hasFlag(DEFAULTINIT)
// Disambiguating: DEFAULTPARAM, TRAIT
- def hasDefault = hasAllFlags(DEFAULTPARAM | PARAM)
- def isTrait = hasFlag(TRAIT) && !hasFlag(PARAM)
+ def hasDefault = hasAllFlags(DEFAULTPARAM | PARAM)
+ def isTrait = hasFlag(TRAIT) && !hasFlag(PARAM)
+ def hasTraitFlag = hasFlag(TRAIT)
+ def hasDefaultFlag = hasFlag(DEFAULTPARAM)
// Straightforwardly named accessors already being used differently.
// These names are most likely temporary.
diff --git a/src/library/scala/reflect/generic/Symbols.scala b/src/library/scala/reflect/generic/Symbols.scala
index 25454698f8..0362e497e5 100755
--- a/src/library/scala/reflect/generic/Symbols.scala
+++ b/src/library/scala/reflect/generic/Symbols.scala
@@ -135,7 +135,6 @@ trait Symbols { self: Universe =>
final def isCovariant = isType && hasFlag(COVARIANT)
final def isEarlyInitialized: Boolean = isTerm && hasFlag(PRESUPER)
final def isExistentiallyBound = isType && hasFlag(EXISTENTIAL)
- final def isGetterOrSetter = hasFlag(ACCESSOR)
final def isImplClass = isClass && hasFlag(IMPLCLASS) // Is this symbol an implementation class for a mixin?
final def isLazyAccessor = isLazy && lazyAccessor != NoSymbol
final def isMethod = isTerm && hasFlag(METHOD)