@@ -90,10 +90,10 @@ object desugar {
90
90
* in apply/unapply methods.
91
91
*/
92
92
override def ensureCompletions (implicit ctx : Context ): Unit =
93
- if (! ( ctx.owner is Package ))
93
+ if (! ctx.owner.is( Package ))
94
94
if (ctx.owner.isClass) {
95
95
ctx.owner.ensureCompleted()
96
- if (ctx.owner is ModuleClass )
96
+ if (ctx.owner.is( ModuleClass ) )
97
97
ctx.owner.linkedClass.ensureCompleted()
98
98
}
99
99
else ensureCompletions(ctx.outer)
@@ -159,7 +159,7 @@ object desugar {
159
159
val vdef @ ValDef (name, tpt, rhs) = transformQuotedPatternName(vdef0)
160
160
val mods = vdef.mods
161
161
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 ))
163
163
if (setterNeeded) {
164
164
// TODO: copy of vdef as getter needed?
165
165
// val getter = ValDef(mods, name, tpt, rhs) withPos vdef.pos?
@@ -174,15 +174,15 @@ object desugar {
174
174
vparamss = (setterParam :: Nil ) :: Nil ,
175
175
tpt = TypeTree (defn.UnitType ),
176
176
rhs = setterRhs
177
- ).withMods((mods | Accessor ) &~ (CaseAccessor | ImplicitOrGiven | Lazy ))
177
+ ).withMods((mods | Accessor ) &~ (CaseAccessor | GivenOrImplicit | Lazy ))
178
178
Thicket (vdef, setter)
179
179
}
180
180
else vdef
181
181
}
182
182
183
183
def makeImplicitParameters (tpts : List [Tree ], implicitFlag : FlagSet , forPrimaryConstructor : Boolean = false )(implicit ctx : Context ): List [ValDef ] =
184
184
for (tpt <- tpts) yield {
185
- val paramFlags : FlagSet = if (forPrimaryConstructor) PrivateLocalParamAccessor else Param
185
+ val paramFlags : FlagSet = if (forPrimaryConstructor) LocalParamAccessor else Param
186
186
val epname = EvidenceParamName .fresh()
187
187
ValDef (epname, tpt, EmptyTree ).withFlags(paramFlags | implicitFlag)
188
188
}
@@ -323,7 +323,7 @@ object desugar {
323
323
meth
324
324
case evidenceParams =>
325
325
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 ) =>
327
327
((evidenceParams ++ vparams) :: rvparamss).reverse
328
328
case _ =>
329
329
meth.vparamss :+ evidenceParams
@@ -334,7 +334,7 @@ object desugar {
334
334
/** The implicit evidence parameters of `meth`, as generated by `desugar.defDef` */
335
335
private def evidenceParams (meth : DefDef )(implicit ctx : Context ): List [ValDef ] =
336
336
meth.vparamss.reverse match {
337
- case (vparams @ (vparam :: _)) :: _ if vparam.mods is ImplicitOrGiven =>
337
+ case (vparams @ (vparam :: _)) :: _ if vparam.mods.isOneOf( GivenOrImplicit ) =>
338
338
vparams.dropWhile(! _.name.is(EvidenceParamName ))
339
339
case _ =>
340
340
Nil
@@ -345,7 +345,7 @@ object desugar {
345
345
private def toDefParam (tparam : TypeDef ): TypeDef =
346
346
tparam.withMods(tparam.rawMods & EmptyFlags | Param )
347
347
private def toDefParam (vparam : ValDef ): ValDef =
348
- vparam.withMods(vparam.rawMods & (ImplicitOrGiven | Erased ) | Param )
348
+ vparam.withMods(vparam.rawMods & (GivenOrImplicit | Erased ) | Param )
349
349
350
350
/** The expansion of a class definition. See inline comments for what is involved */
351
351
def classDef (cdef : TypeDef )(implicit ctx : Context ): Tree = {
@@ -413,7 +413,7 @@ object desugar {
413
413
if (isCaseClass && originalTparams.isEmpty)
414
414
ctx.error(CaseClassMissingParamList (cdef), namePos)
415
415
ListOfNil
416
- } else if (isCaseClass && originalVparamss.head.exists(_.mods.is( ImplicitOrGiven ))) {
416
+ } else if (isCaseClass && originalVparamss.head.exists(_.mods.isOneOf( GivenOrImplicit ))) {
417
417
ctx.error(" Case classes should have a non-implicit parameter list" , namePos)
418
418
ListOfNil
419
419
}
@@ -444,7 +444,7 @@ object desugar {
444
444
if (enumCases.isEmpty)
445
445
ctx.error(" Enumerations must constain at least one case" , namePos)
446
446
val enumCompanionRef = new TermRefTree ()
447
- val enumImport = Import (importImplied = false , enumCompanionRef, enumCases.flatMap(caseIds))
447
+ val enumImport = Import (importDelegate = false , enumCompanionRef, enumCases.flatMap(caseIds))
448
448
(enumImport :: enumStats, enumCases, enumCompanionRef)
449
449
}
450
450
else (stats, Nil , EmptyTree )
@@ -508,7 +508,7 @@ object desugar {
508
508
// new C[Ts](paramss)
509
509
lazy val creatorExpr = {
510
510
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
512
512
Nil :: constrVparamss
513
513
case _ =>
514
514
constrVparamss
@@ -658,7 +658,7 @@ object desugar {
658
658
def widenedCreatorExpr =
659
659
(creatorExpr /: widenDefs)((rhs, meth) => Apply (Ident (meth.name), rhs :: Nil ))
660
660
val applyMeths =
661
- if (mods is Abstract ) Nil
661
+ if (mods.is( Abstract ) ) Nil
662
662
else {
663
663
val copiedFlagsMask = DefaultParameterized | (copiedAccessFlags & Private )
664
664
val appMods = {
@@ -703,9 +703,9 @@ object desugar {
703
703
// synthetic implicit C[Ts](p11: T11, ..., p1N: T1N) ... (pM1: TM1, ..., pMN: TMN): C[Ts] =
704
704
// new C[Ts](p11, ..., p1N) ... (pM1, ..., pMN) =
705
705
val implicitWrappers =
706
- if (! mods.is( ImplicitOrImplied ))
706
+ if (! mods.isOneOf( DelegateOrImplicit ))
707
707
Nil
708
- else if (ctx.owner is Package ) {
708
+ else if (ctx.owner.is( Package ) ) {
709
709
ctx.error(TopLevelImplicitClass (cdef), cdef.sourcePos)
710
710
Nil
711
711
}
@@ -717,7 +717,7 @@ object desugar {
717
717
ctx.error(ImplicitCaseClass (cdef), cdef.sourcePos)
718
718
Nil
719
719
}
720
- else if (arity != 1 && ! mods.is(Implied )) {
720
+ else if (arity != 1 && ! mods.is(Delegate )) {
721
721
ctx.error(ImplicitClassPrimaryConstructorArity (), cdef.sourcePos)
722
722
Nil
723
723
}
@@ -731,7 +731,7 @@ object desugar {
731
731
// implicit wrapper is typechecked in same scope as constructor, so
732
732
// we can reuse the constructor parameters; no derived params are needed.
733
733
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 )
735
735
.withSpan(cdef.span) :: Nil
736
736
}
737
737
@@ -792,7 +792,7 @@ object desugar {
792
792
if (mods.is(Final ) && ! mods.is(Synthetic ))
793
793
ctx.warning(em " ${hl(" final" )} modifier is redundant for objects " , flagSourcePos(Final ))
794
794
795
- if (mods is Package )
795
+ if (mods.is( Package ) )
796
796
PackageDef (Ident (moduleName), cpy.ModuleDef (mdef)(nme.PACKAGE , impl).withMods(mods &~ Package ) :: Nil )
797
797
else if (isEnumCase) {
798
798
typeParamIsReferenced(enumClass.typeParams, Nil , Nil , impl.parents)
@@ -982,7 +982,7 @@ object desugar {
982
982
val restDefs =
983
983
for (((named, tpt), n) <- vars.zipWithIndex if named.name != nme.WILDCARD )
984
984
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 )
986
986
else derivedValDef(original, named, tpt, selector(n), mods)
987
987
flatTree(firstDef :: restDefs)
988
988
}
@@ -1016,9 +1016,9 @@ object desugar {
1016
1016
case tree : MemberDef =>
1017
1017
var tested : MemberDef = tree
1018
1018
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 =
1020
1020
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 " )
1022
1022
tested = tested.withMods(tested.mods.withoutFlags(flag))
1023
1023
}
1024
1024
checkApplicable(Opaque , legalOpaque)
@@ -1109,8 +1109,8 @@ object desugar {
1109
1109
def needsObject (stat : Tree ) = stat match {
1110
1110
case _ : ValDef | _ : PatDef | _ : DefDef | _ : Export => true
1111
1111
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 )
1114
1114
case _ => false
1115
1115
}
1116
1116
val (nestedStats, topStats) = pdef.stats.partition(needsObject)
0 commit comments