Skip to content

Commit 818225e

Browse files
committed
Use isOneOf for checking flag sets with more than one member
1 parent 31f9fed commit 818225e

File tree

75 files changed

+419
-399
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+419
-399
lines changed

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -658,50 +658,50 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
658658
def isConstructor: Boolean = toDenot(sym).isConstructor
659659
def isExpanded: Boolean = sym.name.is(ExpandedName)
660660
def isAnonymousFunction: Boolean = toDenot(sym).isAnonymousFunction
661-
def isMethod: Boolean = sym is Flags.Method
662-
def isPublic: Boolean = sym.flags.is(Flags.EmptyFlags, Flags.Private | Flags.Protected)
663-
def isSynthetic: Boolean = sym is Flags.Synthetic
664-
def isPackageClass: Boolean = sym is Flags.PackageClass
665-
def isModuleClass: Boolean = sym is Flags.ModuleClass
666-
def isModule: Boolean = sym is Flags.Module
661+
def isMethod: Boolean = sym.is(Flags.Method)
662+
def isPublic: Boolean = !sym.flags.is(Flags.Private | Flags.Protected)
663+
def isSynthetic: Boolean = sym.is(Flags.Synthetic)
664+
def isPackageClass: Boolean = sym.is(Flags.PackageClass)
665+
def isModuleClass: Boolean = sym.is(Flags.ModuleClass)
666+
def isModule: Boolean = sym.is(Flags.Module)
667667
def isStrictFP: Boolean = false // todo: implement
668-
def isLabel: Boolean = sym is Flags.Label
669-
def hasPackageFlag: Boolean = sym is Flags.Package
670-
def isInterface: Boolean = (sym is Flags.PureInterface) || (sym is Flags.Trait)
668+
def isLabel: Boolean = sym.is(Flags.Label)
669+
def hasPackageFlag: Boolean = sym.is(Flags.Package)
670+
def isInterface: Boolean = (sym.is(Flags.PureInterface)) || (sym.is(Flags.Trait))
671671
def isGetter: Boolean = toDenot(sym).isGetter
672672
def isSetter: Boolean = toDenot(sym).isSetter
673673
def isGetClass: Boolean = sym eq defn.Any_getClass
674-
def isJavaDefined: Boolean = sym is Flags.JavaDefined
675-
def isJavaDefaultMethod: Boolean = !((sym is Flags.Deferred) || toDenot(sym).isClassConstructor)
676-
def isDeferred: Boolean = sym is Flags.Deferred
677-
def isPrivate: Boolean = sym is Flags.Private
674+
def isJavaDefined: Boolean = sym.is(Flags.JavaDefined)
675+
def isJavaDefaultMethod: Boolean = !((sym.is(Flags.Deferred)) || toDenot(sym).isClassConstructor)
676+
def isDeferred: Boolean = sym.is(Flags.Deferred)
677+
def isPrivate: Boolean = sym.is(Flags.Private)
678678
def getsJavaFinalFlag: Boolean =
679-
isFinal && !toDenot(sym).isClassConstructor && !(sym is Flags.Mutable) && !(sym.enclosingClass is Flags.Trait)
679+
isFinal && !toDenot(sym).isClassConstructor && !(sym.is(Flags.Mutable)) && !(sym.enclosingClass.is(Flags.Trait))
680680

681681
def getsJavaPrivateFlag: Boolean =
682682
isPrivate //|| (sym.isPrimaryConstructor && sym.owner.isTopLevelModuleClass)
683683

684-
def isFinal: Boolean = sym is Flags.Final
684+
def isFinal: Boolean = sym.is(Flags.Final)
685685
def isStaticMember: Boolean = (sym ne NoSymbol) &&
686-
((sym is Flags.JavaStatic) || toDenot(sym).hasAnnotation(ctx.definitions.ScalaStaticAnnot))
686+
((sym.is(Flags.JavaStatic)) || toDenot(sym).hasAnnotation(ctx.definitions.ScalaStaticAnnot))
687687
// guard against no sumbol cause this code is executed to select which call type(static\dynamic) to use to call array.clone
688688

689689
def isBottomClass: Boolean = (sym ne defn.NullClass) && (sym ne defn.NothingClass)
690-
def isBridge: Boolean = sym is Flags.Bridge
691-
def isArtifact: Boolean = sym is Flags.Artifact
690+
def isBridge: Boolean = sym.is(Flags.Bridge)
691+
def isArtifact: Boolean = sym.is(Flags.Artifact)
692692
def hasEnumFlag: Boolean = sym.isAll(Flags.JavaEnum)
693693
def hasAccessBoundary: Boolean = sym.accessBoundary(defn.RootClass) ne defn.RootClass
694-
def isVarargsMethod: Boolean = sym is Flags.JavaVarargs
694+
def isVarargsMethod: Boolean = sym.is(Flags.JavaVarargs)
695695
def isDeprecated: Boolean = false
696-
def isMutable: Boolean = sym is Flags.Mutable
696+
def isMutable: Boolean = sym.is(Flags.Mutable)
697697
def hasAbstractFlag: Boolean =
698-
(sym is Flags.Abstract) || (sym.isAll(Flags.JavaInterface)) || (sym is Flags.Trait)
699-
def hasModuleFlag: Boolean = sym is Flags.Module
700-
def isSynchronized: Boolean = sym is Flags.Synchronized
698+
(sym.is(Flags.Abstract)) || (sym.isAll(Flags.JavaInterface)) || (sym.is(Flags.Trait))
699+
def hasModuleFlag: Boolean = sym.is(Flags.Module)
700+
def isSynchronized: Boolean = sym.is(Flags.Synchronized)
701701
def isNonBottomSubClass(other: Symbol): Boolean = sym.derivesFrom(other)
702702
def hasAnnotation(ann: Symbol): Boolean = toDenot(sym).hasAnnotation(ann)
703703
def shouldEmitForwarders: Boolean =
704-
(sym is Flags.Module) && sym.isStatic
704+
(sym.is(Flags.Module)) && sym.isStatic
705705
def isJavaEntryPoint: Boolean = CollectEntryPoints.isJavaEntryPoint(sym)
706706
def isEnum = sym.is(Flags.Enum)
707707

@@ -713,7 +713,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
713713
* for such objects will get a MODULE$ flag and a corresponding static initializer.
714714
*/
715715
def isStaticModuleClass: Boolean =
716-
(sym is Flags.Module) && {
716+
(sym.is(Flags.Module)) && {
717717
// scalac uses atPickling here
718718
// this would not work if modules are created after pickling
719719
// for example by specialization
@@ -736,7 +736,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
736736
def superClass: Symbol = {
737737
val t = toDenot(sym).asClass.superClass
738738
if (t.exists) t
739-
else if (sym is Flags.ModuleClass) {
739+
else if (sym.is(Flags.ModuleClass)) {
740740
// workaround #371
741741

742742
println(s"Warning: mocking up superclass for $sym")
@@ -749,7 +749,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
749749
def linkedClass: Symbol = toDenot(sym)(ctx).linkedClass(ctx) //exitingPickler(sym.linkedClassOfClass)
750750
def companionClass: Symbol = toDenot(sym).companionClass
751751
def companionModule: Symbol = toDenot(sym).companionModule
752-
def companionSymbol: Symbol = if (sym is Flags.Module) companionClass else companionModule
752+
def companionSymbol: Symbol = if (sym.is(Flags.Module)) companionClass else companionModule
753753
def moduleClass: Symbol = toDenot(sym).moduleClass
754754
def enclosingClassSym: Symbol = {
755755
if (this.isClass) {
@@ -859,7 +859,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
859859
implicit def typeHelper(tp: Type): TypeHelper = new TypeHelper {
860860
def member(string: Name): Symbol = tp.member(string.toTermName).symbol
861861

862-
def isFinalType: Boolean = tp.typeSymbol is Flags.Final //in scalac checks for type parameters. Why? Aren't they gone by backend?
862+
def isFinalType: Boolean = tp.typeSymbol.is(Flags.Final) //in scalac checks for type parameters. Why? Aren't they gone by backend?
863863

864864
def underlying: Type = tp match {
865865
case t: TypeProxy => t.underlying

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ class JSCodeGen()(implicit ctx: Context) {
540540
implicit pos: SourcePosition): Option[js.Tree] = {
541541
val ctors =
542542
if (sym.is(Abstract)) Nil
543-
else sym.info.member(nme.CONSTRUCTOR).alternatives.map(_.symbol).filter(m => !m.is(Private | Protected))
543+
else sym.info.member(nme.CONSTRUCTOR).alternatives.map(_.symbol).filter(m => !m.isOneOf(Private | Protected))
544544

545545
if (ctors.isEmpty) {
546546
None

compiler/src/dotty/tools/backend/sjs/JUnitBootstrappers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class JUnitBootstrappers extends MiniPhase {
128128

129129
def isTestClass(sym: Symbol): Boolean = {
130130
sym.isClass &&
131-
!sym.is(ModuleClass | Abstract | Trait) &&
131+
!sym.isOneOf(ModuleClass | Abstract | Trait) &&
132132
hasTests(sym.asClass)
133133
}
134134

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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.isAll(PrivateLocal) || (ctx.owner is Trait))
162+
mods.is(Mutable) && ctx.owner.isClass && (!mods.isAll(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?
@@ -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(ImplicitOrGiven) =>
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(ImplicitOrGiven) =>
338338
vparams.dropWhile(!_.name.is(EvidenceParamName))
339339
case _ =>
340340
Nil
@@ -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(ImplicitOrGiven))) {
417417
ctx.error("Case classes should have a non-implicit parameter list", namePos)
418418
ListOfNil
419419
}
@@ -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(ImplicitOrGiven) => // 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(ImplicitOrImplied))
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
}
@@ -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
}
@@ -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(ImplicitOrImplied) || opaqueNames.contains(stat.name.stripModuleClassSuffix.toTypeName)
1113+
case stat: TypeDef => !stat.isClassDef || stat.mods.isOneOf(ImplicitOrImplied)
11141114
case _ => false
11151115
}
11161116
val (nestedStats, topStats) = pdef.stats.partition(needsObject)

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ trait UntypedTreeInfo extends TreeInfo[Untyped] { self: Trees.Instance[Untyped]
296296
*/
297297
def lacksDefinition(mdef: MemberDef)(implicit ctx: Context): Boolean = mdef match {
298298
case mdef: ValOrDefDef =>
299-
mdef.unforcedRhs == EmptyTree && !mdef.name.isConstructorName && !mdef.mods.is(TermParamOrAccessor)
299+
mdef.unforcedRhs == EmptyTree && !mdef.name.isConstructorName && !mdef.mods.isOneOf(TermParamOrAccessor)
300300
case mdef: TypeDef =>
301301
def isBounds(rhs: Tree): Boolean = rhs match {
302302
case _: TypeBoundsTree => true
@@ -534,7 +534,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
534534
*/
535535
def isVariableOrGetter(tree: Tree)(implicit ctx: Context): Boolean = {
536536
def sym = tree.symbol
537-
def isVar = sym is Mutable
537+
def isVar = sym.is(Mutable)
538538
def isGetter =
539539
mayBeVarGetter(sym) && sym.owner.info.member(sym.name.asTermName.setterName).exists
540540

@@ -661,7 +661,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
661661
private def isSimpleThrowable(tp: Type)(implicit ctx: Context): Boolean = tp match {
662662
case tp @ TypeRef(pre, _) =>
663663
(pre == NoPrefix || pre.widen.typeSymbol.isStatic) &&
664-
(tp.symbol derivesFrom defn.ThrowableClass) && !(tp.symbol is Trait)
664+
(tp.symbol derivesFrom defn.ThrowableClass) && !tp.symbol.is(Trait)
665665
case _ =>
666666
false
667667
}
@@ -719,7 +719,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
719719
else Nil
720720
case vdef: ValDef =>
721721
val sym = vdef.symbol
722-
assert(sym is Module)
722+
assert(sym.is(Module))
723723
if (cls == sym.companionClass || cls == sym.moduleClass) vdef :: Nil
724724
else Nil
725725
case tree =>

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ object Trees {
410410
// Denotation of a This tree is always the underlying class; needs correction for modules.
411411
override def denot(implicit ctx: Context): Denotation = {
412412
typeOpt match {
413-
case tpe @ TermRef(pre, _) if tpe.symbol is Module =>
413+
case tpe @ TermRef(pre, _) if tpe.symbol.is(Module) =>
414414
tpe.symbol.moduleClass.denot.asSeenFrom(pre)
415415
case _ =>
416416
super.denot
@@ -750,7 +750,7 @@ object Trees {
750750
def unforced: LazyTree = preRhs
751751
protected def force(x: AnyRef): Unit = preRhs = x
752752

753-
override def disableOverlapChecks = rawMods.is(Flags.Implied)
753+
override def disableOverlapChecks = rawMods.is(Implied)
754754
// disable order checks for implicit aliases since their given clause follows
755755
// their for clause, but the two appear swapped in the DefDef.
756756
}

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
268268
def ClassDef(cls: ClassSymbol, constr: DefDef, body: List[Tree], superArgs: List[Tree] = Nil)(implicit ctx: Context): TypeDef = {
269269
val firstParent :: otherParents = cls.info.parents
270270
val superRef =
271-
if (cls is Trait) TypeTree(firstParent)
271+
if (cls.is(Trait)) TypeTree(firstParent)
272272
else {
273273
def isApplicable(ctpe: Type): Boolean = ctpe match {
274274
case ctpe: PolyType =>
@@ -289,7 +289,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
289289
if (cls.classInfo.selfInfo ne NoType) ValDef(ctx.newSelfSym(cls))
290290
else EmptyValDef
291291
def isOwnTypeParam(stat: Tree) =
292-
(stat.symbol is TypeParam) && stat.symbol.owner == cls
292+
(stat.symbol.is(TypeParam)) && stat.symbol.owner == cls
293293
val bodyTypeParams = body filter isOwnTypeParam map (_.symbol)
294294
val newTypeParams =
295295
for (tparam <- cls.typeParams if !(bodyTypeParams contains tparam))
@@ -964,7 +964,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
964964
*/
965965
def becomes(rhs: Tree)(implicit ctx: Context): Tree = {
966966
val sym = tree.symbol
967-
if (sym is Method) {
967+
if (sym.is(Method)) {
968968
val setter = sym.setter.orElse {
969969
assert(sym.name.isSetterName && sym.info.firstParamTypes.nonEmpty)
970970
sym
@@ -1002,7 +1002,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
10021002
* Returns true if the symbol is a val or def generated by eta-expansion/inline
10031003
*/
10041004
override protected def skipLocal(sym: Symbol): Boolean =
1005-
sym.is(InlineProxy) || sym.is(Synthetic)
1005+
sym.isOneOf(InlineProxy | Synthetic)
10061006
}
10071007
mapToUnderlying.transform(tree)
10081008
}

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,10 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
183183
annotations: List[Tree] = Nil,
184184
mods: List[Mod] = Nil) {
185185

186-
def is(fs: FlagSet): Boolean = flags is fs
186+
def is(fs: FlagSet): Boolean = flags.is(fs)
187187
def is(fs: FlagSet, butNot: FlagSet): Boolean = flags.is(fs, butNot = butNot)
188+
def isOneOf(fs: FlagSet): Boolean = flags.isOneOf(fs)
189+
def isOneOf(fs: FlagSet, butNot: FlagSet): Boolean = flags.isOneOf(fs, butNot = butNot)
188190
def isAll(fc: FlagConjunction): Boolean = flags.isAll(fc)
189191

190192
def | (fs: FlagSet): Modifiers = withFlags(flags | fs)
@@ -215,7 +217,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
215217
else {
216218
if (ms.nonEmpty)
217219
for (m <- ms)
218-
assert(flags.is(m.flags) ||
220+
assert(flags.isAll(allOf(m.flags)) ||
219221
m.isInstanceOf[Mod.Private] && !privateWithin.isEmpty,
220222
s"unaccounted modifier: $m in $this when adding $ms")
221223
copy(mods = ms)

compiler/src/dotty/tools/dotc/core/CheckRealizable.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ object CheckRealizable {
4747
def boundsRealizability(tp: Type)(implicit ctx: Context): Realizability =
4848
new CheckRealizable().boundsRealizability(tp)
4949

50-
private val LateInitialized = Lazy | Erased
50+
private val LateInitializedFlags = Lazy | Erased
5151
}
5252

5353
/** Compute realizability status.
@@ -70,7 +70,7 @@ class CheckRealizable(implicit ctx: Context) {
7070
/** Is symbol's definitition a lazy or erased val?
7171
* (note we exclude modules here, because their realizability is ensured separately)
7272
*/
73-
private def isLateInitialized(sym: Symbol) = sym.is(LateInitialized, butNot = Module)
73+
private def isLateInitialized(sym: Symbol) = sym.isOneOf(LateInitializedFlags, butNot = Module)
7474

7575
/** The realizability status of given type `tp`*/
7676
def realizability(tp: Type): Realizability = tp.dealias match {
@@ -183,7 +183,7 @@ class CheckRealizable(implicit ctx: Context) {
183183
private def memberRealizability(tp: Type) = {
184184
def checkField(sofar: Realizability, fld: SingleDenotation): Realizability =
185185
sofar andAlso {
186-
if (checkedFields.contains(fld.symbol) || fld.symbol.is(Private | Mutable | LateInitialized))
186+
if (checkedFields.contains(fld.symbol) || fld.symbol.isOneOf(Private | Mutable | LateInitializedFlags))
187187
// if field is private it cannot be part of a visible path
188188
// if field is mutable it cannot be part of a path
189189
// if field is lazy or erased it does not need to be initialized when the owning object is

0 commit comments

Comments
 (0)