diff --git a/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala b/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala index 1413ab2933a0..745e53693c83 100644 --- a/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala +++ b/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala @@ -846,7 +846,7 @@ class JSCodeGen()(using genCtx: Context) { // Term members that are neither methods nor modules are fields classSym.info.decls.filter { f => - !f.isOneOf(Method | Module) && f.isTerm + !f.isOneOf(MethodOrModule) && f.isTerm && !f.hasAnnotation(jsdefn.JSNativeAnnot) && !f.hasAnnotation(jsdefn.JSOptionalAnnot) && !f.hasAnnotation(jsdefn.JSExportStaticAnnot) diff --git a/compiler/src/dotty/tools/backend/sjs/JSEncoding.scala b/compiler/src/dotty/tools/backend/sjs/JSEncoding.scala index c2e0dea3841b..cf89873b9c80 100644 --- a/compiler/src/dotty/tools/backend/sjs/JSEncoding.scala +++ b/compiler/src/dotty/tools/backend/sjs/JSEncoding.scala @@ -175,7 +175,7 @@ object JSEncoding { js.StringLiteral(encodeFieldSymAsString(sym)) private def encodeFieldSymAsString(sym: Symbol)(using Context): String = { - require(sym.owner.isClass && sym.isTerm && !sym.isOneOf(Method | Module), + require(sym.owner.isClass && sym.isTerm && !sym.isOneOf(MethodOrModule), "encodeFieldSym called with non-field symbol: " + sym) val name0 = sym.javaSimpleName diff --git a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala index ee45e5f967d9..542ce8c080d5 100644 --- a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -502,7 +502,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => else if (sym.is(Module)) if (sym.moduleClass.isNoInitsRealClass) PurePath else IdempotentPath else if (sym.is(Lazy)) IdempotentPath - else if sym.isAllOf(Inline | Param) then Impure + else if sym.isAllOf(InlineParam) then Impure else PurePath } diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 51a15f77142a..3e2373d3bd4b 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -288,8 +288,8 @@ class Definitions { @tu lazy val Any_## : TermSymbol = enterMethod(AnyClass, nme.HASHHASH, ExprType(IntType), Final) @tu lazy val Any_isInstanceOf: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.isInstanceOf_, _ => BooleanType, Final) @tu lazy val Any_asInstanceOf: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.asInstanceOf_, _.paramRefs(0), Final) - @tu lazy val Any_typeTest: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.isInstanceOfPM, _ => BooleanType, Final | Synthetic | Artifact) - @tu lazy val Any_typeCast: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.asInstanceOfPM, _.paramRefs(0), Final | Synthetic | Artifact | StableRealizable) + @tu lazy val Any_typeTest: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.isInstanceOfPM, _ => BooleanType, Final | SyntheticArtifact) + @tu lazy val Any_typeCast: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.asInstanceOfPM, _.paramRefs(0), Final | SyntheticArtifact | StableRealizable) // generated by pattern matcher and explicit nulls, eliminated by erasure /** def getClass[A >: this.type](): Class[? <: A] */ diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index e8ecf1c88f8c..855717fb1d6f 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -2873,7 +2873,7 @@ object Parsers { if (mods.is(Private) && mods.hasPrivateWithin) normalize(mods &~ Private) else if (mods.isAllOf(AbstractOverride)) - normalize(addFlag(mods &~ (Abstract | Override), AbsOverride)) + normalize(addFlag(mods &~ AbstractOverride, AbsOverride)) else mods @@ -3034,7 +3034,7 @@ object Parsers { val tps = commaSeparated(funArgType) var counter = nparams def nextIdx = { counter += 1; counter } - val paramFlags = if ofClass then Private | Local | ParamAccessor else Param + val paramFlags = if ofClass then LocalParamAccessor else Param tps.map(makeSyntheticParameter(nextIdx, _, paramFlags | Synthetic | impliedMods.flags)) /** ClsParamClause ::= ‘(’ [‘erased’] ClsParams ‘)’ | UsingClsParamClause diff --git a/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala b/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala index 8dba16951c6f..ac29275b2210 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala @@ -137,7 +137,7 @@ class ExpandSAMs extends MiniPhase: def translateMatch(tree: Match, pfParam: Symbol, cases: List[CaseDef], defaultValue: Tree)(using Context) = { val selector = tree.selector val selectorTpe = selector.tpe.widen - val defaultSym = newSymbol(pfParam.owner, nme.WILDCARD, Synthetic | Case, selectorTpe) + val defaultSym = newSymbol(pfParam.owner, nme.WILDCARD, SyntheticCase, selectorTpe) val defaultCase = CaseDef( Bind(defaultSym, Underscore(selectorTpe)), diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala index d428575d0e4a..ed3bfc7c0181 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -185,14 +185,14 @@ object ExplicitOuter { /** A new param accessor for the outer field in class `cls` */ private def newOuterParamAccessor(cls: ClassSymbol)(using Context) = - newOuterSym(cls, cls, nme.OUTER, Private | Local | ParamAccessor) + newOuterSym(cls, cls, nme.OUTER, LocalParamAccessor) /** A new outer accessor for class `cls` which is a member of `owner` */ private def newOuterAccessor(owner: ClassSymbol, cls: ClassSymbol)(using Context) = { val deferredIfTrait = if (owner.is(Trait)) Deferred else EmptyFlags val outerAccIfOwn = if (owner == cls) OuterAccessor else EmptyFlags newOuterSym(owner, cls, outerAccName(cls), - Final | Method | StableRealizable | outerAccIfOwn | deferredIfTrait) + Final | StableMethod | outerAccIfOwn | deferredIfTrait) } private def outerAccName(cls: ClassSymbol)(using Context): TermName = diff --git a/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala b/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala index 442bf27d9f6b..5cf97ab5cb7b 100644 --- a/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala +++ b/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala @@ -282,7 +282,7 @@ class InstrumentCoverage extends MacroTransform with IdentityDenotTransformer: def isContextual(fun: Apply): Boolean = val args = fun.args - args.nonEmpty && args.head.symbol.isAllOf(Given | Implicit) + args.nonEmpty && args.head.symbol.isAllOf(GivenOrImplicit) val fun = tree.fun val nestedApplyNeedsLift = fun match diff --git a/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala b/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala index bb073666363b..6ec0f330efff 100644 --- a/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala +++ b/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala @@ -70,7 +70,7 @@ object LambdaLift: private def generateProxies()(using Context): Unit = for owner <- deps.tracked do val fvs = deps.freeVars(owner).toList - val newFlags = Synthetic | (if (owner.isClass) ParamAccessor | Private else Param) + val newFlags = Synthetic | (if (owner.isClass) PrivateParamAccessor else Param) report.debuglog(i"free var proxy of ${owner.showLocated}: $fvs%, %") val freeProxyPairs = for fv <- fvs yield diff --git a/compiler/src/dotty/tools/dotc/transform/LazyVals.scala b/compiler/src/dotty/tools/dotc/transform/LazyVals.scala index 74874843b4f6..c32ea61cff2b 100644 --- a/compiler/src/dotty/tools/dotc/transform/LazyVals.scala +++ b/compiler/src/dotty/tools/dotc/transform/LazyVals.scala @@ -345,7 +345,7 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer { } val retryCase = { - val caseSymbol = newSymbol(methodSymbol, nme.DEFAULT_EXCEPTION_NAME, Synthetic | Case, defn.ThrowableType) + val caseSymbol = newSymbol(methodSymbol, nme.DEFAULT_EXCEPTION_NAME, SyntheticCase, defn.ThrowableType) val triggerRetry = setFlagState.appliedTo(thiz, offset, initState, fieldId) CaseDef( Bind(caseSymbol, ref(caseSymbol)), diff --git a/compiler/src/dotty/tools/dotc/transform/ParamForwarding.scala b/compiler/src/dotty/tools/dotc/transform/ParamForwarding.scala index 5d147755f22b..94ea48e14efd 100644 --- a/compiler/src/dotty/tools/dotc/transform/ParamForwarding.scala +++ b/compiler/src/dotty/tools/dotc/transform/ParamForwarding.scala @@ -60,7 +60,7 @@ class ParamForwarding extends MiniPhase with IdentityDenotTransformer: if alias.exists then sym.copySymDenotation( name = ParamAccessorName(sym.name), - initFlags = sym.flags | Method | StableRealizable, + initFlags = sym.flags | StableMethod, info = sym.info.ensureMethodic ).installAfter(thisPhase) val superAcc = diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala index 981338697e4c..201e8a0db31f 100644 --- a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -99,7 +99,7 @@ object PatternMatcher { private val initializer = MutableSymbolMap[Tree]() private def newVar(rhs: Tree, flags: FlagSet, tpe: Type): TermSymbol = - newSymbol(ctx.owner, PatMatStdBinderName.fresh(), Synthetic | Case | flags, + newSymbol(ctx.owner, PatMatStdBinderName.fresh(), SyntheticCase | flags, sanitize(tpe), coord = rhs.span) // TODO: Drop Case once we use everywhere else `isPatmatGenerated`. diff --git a/compiler/src/dotty/tools/dotc/transform/SymUtils.scala b/compiler/src/dotty/tools/dotc/transform/SymUtils.scala index 43790545c1fa..95cf47fec4f8 100644 --- a/compiler/src/dotty/tools/dotc/transform/SymUtils.scala +++ b/compiler/src/dotty/tools/dotc/transform/SymUtils.scala @@ -128,7 +128,7 @@ object SymUtils: isCodefined(mt.resultType) case res => self.isCoDefinedGiven(res.typeSymbol) - self.isAllOf(Given | Method) && isCodefined(self.info) + self.isAllOf(GivenMethod) && isCodefined(self.info) // TODO Scala 3.x: only check for inline vals (no final ones) def isInlineVal(using Context) = diff --git a/compiler/src/dotty/tools/dotc/transform/SyntheticMembers.scala b/compiler/src/dotty/tools/dotc/transform/SyntheticMembers.scala index d5a17c2248f9..79ebb1d4e72b 100644 --- a/compiler/src/dotty/tools/dotc/transform/SyntheticMembers.scala +++ b/compiler/src/dotty/tools/dotc/transform/SyntheticMembers.scala @@ -257,7 +257,7 @@ class SyntheticMembers(thisPhase: DenotTransformer) { * */ def equalsBody(that: Tree)(using Context): Tree = { - val thatAsClazz = newSymbol(ctx.owner, nme.x_0, Synthetic | Case, clazzType, coord = ctx.owner.span) // x$0 + val thatAsClazz = newSymbol(ctx.owner, nme.x_0, SyntheticCase, clazzType, coord = ctx.owner.span) // x$0 def wildcardAscription(tp: Type) = Typed(Underscore(tp), TypeTree(tp)) val pattern = Bind(thatAsClazz, wildcardAscription(AnnotatedType(clazzType, Annotation(defn.UncheckedAnnot)))) // x$0 @ (_: C @unchecked) // compare primitive fields first, slow equality checks of non-primitive fields can be skipped when primitives differ @@ -405,11 +405,11 @@ class SyntheticMembers(thisPhase: DenotTransformer) { .exists private def writeReplaceDef(clazz: ClassSymbol)(using Context): TermSymbol = - newSymbol(clazz, nme.writeReplace, Method | Private | Synthetic, + newSymbol(clazz, nme.writeReplace, PrivateMethod | Synthetic, MethodType(Nil, defn.AnyRefType), coord = clazz.coord).entered.asTerm private def readResolveDef(clazz: ClassSymbol)(using Context): TermSymbol = - newSymbol(clazz, nme.readResolve, Method | Private | Synthetic, + newSymbol(clazz, nme.readResolve, PrivateMethod | Synthetic, MethodType(Nil, defn.AnyRefType), coord = clazz.coord).entered.asTerm /** If this is a static object `Foo`, add the method: diff --git a/compiler/src/dotty/tools/dotc/transform/sjs/ExplicitJSClasses.scala b/compiler/src/dotty/tools/dotc/transform/sjs/ExplicitJSClasses.scala index 9353f6d82a8b..3c87621413b7 100644 --- a/compiler/src/dotty/tools/dotc/transform/sjs/ExplicitJSClasses.scala +++ b/compiler/src/dotty/tools/dotc/transform/sjs/ExplicitJSClasses.scala @@ -364,7 +364,7 @@ class ExplicitJSClasses extends MiniPhase with InfoTransformer { thisPhase => } val fieldName = jsclassFieldName(innerJSClass.name.asTypeName) - val fieldFlags = Synthetic | Artifact + val fieldFlags = SyntheticArtifact val field = newSymbol(cls, fieldName, fieldFlags, defn.AnyRefType, coord = innerJSClass.coord) addAnnotsIfInJSClass(field) decls1.enter(field) @@ -376,7 +376,7 @@ class ExplicitJSClasses extends MiniPhase with InfoTransformer { thisPhase => i"trying to ad-hoc expose objects in non-JS static object ${cls.fullName}") val getterName = jsobjectGetterNameFor(innerObject) - val getterFlags = Method | Synthetic | Artifact + val getterFlags = Method | SyntheticArtifact val getter = newSymbol(cls, getterName, getterFlags, ExprType(defn.AnyRefType), coord = innerObject.coord) addAnnots(getter, innerObject) decls1.enter(getter) diff --git a/compiler/src/dotty/tools/dotc/typer/Deriving.scala b/compiler/src/dotty/tools/dotc/typer/Deriving.scala index 0f3a138d0390..d2165a5ca8c5 100644 --- a/compiler/src/dotty/tools/dotc/typer/Deriving.scala +++ b/compiler/src/dotty/tools/dotc/typer/Deriving.scala @@ -49,7 +49,7 @@ trait Deriving { // If we set the Synthetic flag here widenGiven will widen too far and the // derived instance will have too low a priority to be selected over a freshly // derived instance at the summoning site. - val flags = if info.isInstanceOf[MethodOrPoly] then Given | Method else Given | Lazy + val flags = if info.isInstanceOf[MethodOrPoly] then GivenMethod else Given | Lazy synthetics += newSymbol(ctx.owner, instanceName, flags, info, coord = pos.span) .entered diff --git a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala index 14edd1947060..34b7bd96b343 100644 --- a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala +++ b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala @@ -258,7 +258,7 @@ object EtaExpansion extends LiftImpure { val paramTypes: List[Tree] = if (isLastApplication && mt.paramInfos.length == xarity) mt.paramInfos map (_ => TypeTree()) else mt.paramInfos map TypeTree - var paramFlag = Synthetic | Param + var paramFlag = SyntheticParam if (mt.isContextualMethod) paramFlag |= Given else if (mt.isImplicitMethod) paramFlag |= Implicit val params = mt.paramNames.lazyZip(paramTypes).map((name, tpe) => diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 52a51305e995..ad71c86318a1 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -435,7 +435,7 @@ object Inliner { | Literal(_) => true case Ident(_) => - isPureRef(tree) || tree.symbol.isAllOf(Inline | Param) + isPureRef(tree) || tree.symbol.isAllOf(InlineParam) case Select(qual, _) => if (tree.symbol.is(Erased)) true else isPureRef(tree) && apply(qual) @@ -969,7 +969,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) { case t: ThisType => thisProxy.getOrElse(t.cls, t) case t: TypeRef => paramProxy.getOrElse(t, mapOver(t)) case t: SingletonType => - if t.termSymbol.isAllOf(Inline | Param) then apply(t.widenTermRefExpr) + if t.termSymbol.isAllOf(InlineParam) then apply(t.widenTermRefExpr) else paramProxy.getOrElse(t, mapOver(t)) case t => mapOver(t) } diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 3b9a9e1ac382..de5ffdeea986 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -905,7 +905,7 @@ class Namer { typer: Typer => if denot.isClass && !sym.isEnumAnonymClass && !sym.isRefinementClass then val child = if (denot.is(Module)) denot.sourceModule else denot.symbol denot.info.parents.foreach { parent => register(child, parent.classSymbol.asClass) } - else if denot.is(CaseVal, butNot = Method | Module) then + else if denot.is(CaseVal, butNot = MethodOrModule) then assert(denot.is(Enum), denot) denot.info.classSymbols.foreach { parent => register(denot.symbol, parent) } end if diff --git a/compiler/src/dotty/tools/dotc/typer/Nullables.scala b/compiler/src/dotty/tools/dotc/typer/Nullables.scala index 0d4d23243f46..9104418d406f 100644 --- a/compiler/src/dotty/tools/dotc/typer/Nullables.scala +++ b/compiler/src/dotty/tools/dotc/typer/Nullables.scala @@ -267,7 +267,7 @@ object Nullables: @tailrec def recur(s: Symbol): Boolean = s != NoSymbol && s != refOwner - && (s.isOneOf(Lazy | Method) // not at the rhs of lazy ValDef or in a method (or lambda) + && (s.isOneOf(MethodOrLazy) // not at the rhs of lazy ValDef or in a method (or lambda) || s.isClass // not in a class || recur(s.owner)) diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index 738c73bcc5b0..b416b028efe8 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -490,7 +490,7 @@ object RefChecks { "(this rule is designed to prevent ``accidental overrides'')") else if (other.isStableMember && !member.isStableMember) // (1.5) overrideError("needs to be a stable, immutable value") - else if (member.is(ModuleVal) && !other.isRealMethod && !other.isOneOf(Deferred | Lazy)) + else if (member.is(ModuleVal) && !other.isRealMethod && !other.isOneOf(DeferredOrLazy)) overrideError("may not override a concrete non-lazy value") else if (member.is(Lazy, butNot = Module) && !other.isRealMethod && !other.is(Lazy) && !warnOnMigration(overrideErrorMsg("may not override a non-lazy value"), member.srcPos, version = `3.0`))