@@ -90,10 +90,10 @@ object desugar {
9090 * in apply/unapply methods.
9191 */
9292 override def ensureCompletions (implicit ctx : Context ): Unit =
93- if (! ( ctx.owner is Package ))
93+ if (! ctx.owner.is( Package ))
9494 if (ctx.owner.isClass) {
9595 ctx.owner.ensureCompleted()
96- if (ctx.owner is ModuleClass )
96+ if (ctx.owner.is( ModuleClass ) )
9797 ctx.owner.linkedClass.ensureCompleted()
9898 }
9999 else ensureCompletions(ctx.outer)
@@ -159,7 +159,7 @@ object desugar {
159159 val vdef @ ValDef (name, tpt, rhs) = transformQuotedPatternName(vdef0)
160160 val mods = vdef.mods
161161 val setterNeeded =
162- ( mods is Mutable ) && ctx.owner.isClass && (! ( mods is PrivateLocal ) || ( ctx.owner is Trait ))
162+ mods.is( Mutable ) && ctx.owner.isClass && (! mods.isAllOf( PrivateLocal ) || ctx.owner.is( Trait ))
163163 if (setterNeeded) {
164164 // TODO: copy of vdef as getter needed?
165165 // val getter = ValDef(mods, name, tpt, rhs) withPos vdef.pos?
@@ -174,15 +174,15 @@ object desugar {
174174 vparamss = (setterParam :: Nil ) :: Nil ,
175175 tpt = TypeTree (defn.UnitType ),
176176 rhs = setterRhs
177- ).withMods((mods | Accessor ) &~ (CaseAccessor | ImplicitOrGiven | Lazy ))
177+ ).withMods((mods | Accessor ) &~ (CaseAccessor | GivenOrImplicit | Lazy ))
178178 Thicket (vdef, setter)
179179 }
180180 else vdef
181181 }
182182
183183 def makeImplicitParameters (tpts : List [Tree ], implicitFlag : FlagSet , forPrimaryConstructor : Boolean = false )(implicit ctx : Context ): List [ValDef ] =
184184 for (tpt <- tpts) yield {
185- val paramFlags : FlagSet = if (forPrimaryConstructor) PrivateLocalParamAccessor else Param
185+ val paramFlags : FlagSet = if (forPrimaryConstructor) LocalParamAccessor else Param
186186 val epname = EvidenceParamName .fresh()
187187 ValDef (epname, tpt, EmptyTree ).withFlags(paramFlags | implicitFlag)
188188 }
@@ -323,7 +323,7 @@ object desugar {
323323 meth
324324 case evidenceParams =>
325325 val vparamss1 = meth.vparamss.reverse match {
326- case (vparams @ (vparam :: _)) :: rvparamss if vparam.mods is ImplicitOrGiven =>
326+ case (vparams @ (vparam :: _)) :: rvparamss if vparam.mods.isOneOf( GivenOrImplicit ) =>
327327 ((evidenceParams ++ vparams) :: rvparamss).reverse
328328 case _ =>
329329 meth.vparamss :+ evidenceParams
@@ -334,7 +334,7 @@ object desugar {
334334 /** The implicit evidence parameters of `meth`, as generated by `desugar.defDef` */
335335 private def evidenceParams (meth : DefDef )(implicit ctx : Context ): List [ValDef ] =
336336 meth.vparamss.reverse match {
337- case (vparams @ (vparam :: _)) :: _ if vparam.mods is ImplicitOrGiven =>
337+ case (vparams @ (vparam :: _)) :: _ if vparam.mods.isOneOf( GivenOrImplicit ) =>
338338 vparams.dropWhile(! _.name.is(EvidenceParamName ))
339339 case _ =>
340340 Nil
@@ -345,7 +345,7 @@ object desugar {
345345 private def toDefParam (tparam : TypeDef ): TypeDef =
346346 tparam.withMods(tparam.rawMods & EmptyFlags | Param )
347347 private def toDefParam (vparam : ValDef ): ValDef =
348- vparam.withMods(vparam.rawMods & (ImplicitOrGiven | Erased ) | Param )
348+ vparam.withMods(vparam.rawMods & (GivenOrImplicit | Erased ) | Param )
349349
350350 /** The expansion of a class definition. See inline comments for what is involved */
351351 def classDef (cdef : TypeDef )(implicit ctx : Context ): Tree = {
@@ -413,7 +413,7 @@ object desugar {
413413 if (isCaseClass && originalTparams.isEmpty)
414414 ctx.error(CaseClassMissingParamList (cdef), namePos)
415415 ListOfNil
416- } else if (isCaseClass && originalVparamss.head.exists(_.mods.is( ImplicitOrGiven ))) {
416+ } else if (isCaseClass && originalVparamss.head.exists(_.mods.isOneOf( GivenOrImplicit ))) {
417417 ctx.error(" Case classes should have a non-implicit parameter list" , namePos)
418418 ListOfNil
419419 }
@@ -444,7 +444,7 @@ object desugar {
444444 if (enumCases.isEmpty)
445445 ctx.error(" Enumerations must constain at least one case" , namePos)
446446 val enumCompanionRef = new TermRefTree ()
447- val enumImport = Import (importImplied = false , enumCompanionRef, enumCases.flatMap(caseIds))
447+ val enumImport = Import (importDelegate = false , enumCompanionRef, enumCases.flatMap(caseIds))
448448 (enumImport :: enumStats, enumCases, enumCompanionRef)
449449 }
450450 else (stats, Nil , EmptyTree )
@@ -508,7 +508,7 @@ object desugar {
508508 // new C[Ts](paramss)
509509 lazy val creatorExpr = {
510510 val vparamss = constrVparamss match {
511- case (vparam :: _) :: _ if vparam.mods.is( ImplicitOrGiven ) => // add a leading () to match class parameters
511+ case (vparam :: _) :: _ if vparam.mods.isOneOf( GivenOrImplicit ) => // add a leading () to match class parameters
512512 Nil :: constrVparamss
513513 case _ =>
514514 constrVparamss
@@ -658,7 +658,7 @@ object desugar {
658658 def widenedCreatorExpr =
659659 (creatorExpr /: widenDefs)((rhs, meth) => Apply (Ident (meth.name), rhs :: Nil ))
660660 val applyMeths =
661- if (mods is Abstract ) Nil
661+ if (mods.is( Abstract ) ) Nil
662662 else {
663663 val copiedFlagsMask = DefaultParameterized | (copiedAccessFlags & Private )
664664 val appMods = {
@@ -703,9 +703,9 @@ object desugar {
703703 // synthetic implicit C[Ts](p11: T11, ..., p1N: T1N) ... (pM1: TM1, ..., pMN: TMN): C[Ts] =
704704 // new C[Ts](p11, ..., p1N) ... (pM1, ..., pMN) =
705705 val implicitWrappers =
706- if (! mods.is( ImplicitOrImplied ))
706+ if (! mods.isOneOf( DelegateOrImplicit ))
707707 Nil
708- else if (ctx.owner is Package ) {
708+ else if (ctx.owner.is( Package ) ) {
709709 ctx.error(TopLevelImplicitClass (cdef), cdef.sourcePos)
710710 Nil
711711 }
@@ -717,7 +717,7 @@ object desugar {
717717 ctx.error(ImplicitCaseClass (cdef), cdef.sourcePos)
718718 Nil
719719 }
720- else if (arity != 1 && ! mods.is(Implied )) {
720+ else if (arity != 1 && ! mods.is(Delegate )) {
721721 ctx.error(ImplicitClassPrimaryConstructorArity (), cdef.sourcePos)
722722 Nil
723723 }
@@ -731,7 +731,7 @@ object desugar {
731731 // implicit wrapper is typechecked in same scope as constructor, so
732732 // we can reuse the constructor parameters; no derived params are needed.
733733 DefDef (className.toTermName, constrTparams, defParamss, classTypeRef, creatorExpr)
734- .withMods(companionMods | mods.flags.toTermFlags & ImplicitOrImplied | Synthetic | Final )
734+ .withMods(companionMods | mods.flags.toTermFlags & DelegateOrImplicit | Synthetic | Final )
735735 .withSpan(cdef.span) :: Nil
736736 }
737737
@@ -792,7 +792,7 @@ object desugar {
792792 if (mods.is(Final ) && ! mods.is(Synthetic ))
793793 ctx.warning(em " ${hl(" final" )} modifier is redundant for objects " , flagSourcePos(Final ))
794794
795- if (mods is Package )
795+ if (mods.is( Package ) )
796796 PackageDef (Ident (moduleName), cpy.ModuleDef (mdef)(nme.PACKAGE , impl).withMods(mods &~ Package ) :: Nil )
797797 else if (isEnumCase) {
798798 typeParamIsReferenced(enumClass.typeParams, Nil , Nil , impl.parents)
@@ -982,7 +982,7 @@ object desugar {
982982 val restDefs =
983983 for (((named, tpt), n) <- vars.zipWithIndex if named.name != nme.WILDCARD )
984984 yield
985- if (mods is Lazy ) derivedDefDef(original, named, tpt, selector(n), mods &~ Lazy )
985+ if (mods.is( Lazy ) ) derivedDefDef(original, named, tpt, selector(n), mods &~ Lazy )
986986 else derivedValDef(original, named, tpt, selector(n), mods)
987987 flatTree(firstDef :: restDefs)
988988 }
@@ -1016,9 +1016,9 @@ object desugar {
10161016 case tree : MemberDef =>
10171017 var tested : MemberDef = tree
10181018 def fail (msg : String ) = ctx.error(msg, tree.sourcePos)
1019- def checkApplicable (flag : FlagSet , test : MemberDefTest ): Unit =
1019+ def checkApplicable (flag : Flag , test : MemberDefTest ): Unit =
10201020 if (tested.mods.is(flag) && ! test.applyOrElse(tree, (md : MemberDef ) => false )) {
1021- fail(i " modifier ` $flag` is not allowed for this definition " )
1021+ fail(i " modifier ` ${ flag.flagsString} ` is not allowed for this definition " )
10221022 tested = tested.withMods(tested.mods.withoutFlags(flag))
10231023 }
10241024 checkApplicable(Opaque , legalOpaque)
@@ -1109,8 +1109,8 @@ object desugar {
11091109 def needsObject (stat : Tree ) = stat match {
11101110 case _ : ValDef | _ : PatDef | _ : DefDef | _ : Export => true
11111111 case stat : ModuleDef =>
1112- stat.mods.is( ImplicitOrImplied ) || opaqueNames.contains(stat.name.stripModuleClassSuffix.toTypeName)
1113- case stat : TypeDef => ! stat.isClassDef || stat.mods.is( ImplicitOrImplied )
1112+ stat.mods.isOneOf( DelegateOrImplicit ) || opaqueNames.contains(stat.name.stripModuleClassSuffix.toTypeName)
1113+ case stat : TypeDef => ! stat.isClassDef || stat.mods.isOneOf( DelegateOrImplicit )
11141114 case _ => false
11151115 }
11161116 val (nestedStats, topStats) = pdef.stats.partition(needsObject)
0 commit comments