Skip to content

Commit a924104

Browse files
committed
Introduce setFlagFrom
1 parent 45a4b00 commit a924104

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,11 @@ object SymDenotations {
14851485
override def transformAfter(phase: DenotTransformer, f: SymDenotation => SymDenotation)(implicit ctx: Context): Unit =
14861486
super.transformAfter(phase, f)
14871487

1488+
/** Set flag `flags` in current phase and in all phases that follow */
1489+
def setFlagFrom(phase: DenotTransformer, flags: FlagSet)(using Context): Unit =
1490+
setFlag(flags)
1491+
transformAfter(phase, sd => { sd.setFlag(flags); sd })
1492+
14881493
/** If denotation is private, remove the Private flag and expand the name if necessary */
14891494
def ensureNotPrivate(implicit ctx: Context): SymDenotation =
14901495
if (is(Private))

compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class AugmentScala2Traits extends MiniPhase with IdentityDenotTransformer { this
6464
|| sym.isSuperAccessor) // scala2 superaccessors are pickled as private, but are compiled as public expanded
6565
sym.ensureNotPrivate.installAfter(thisPhase)
6666
}
67-
mixin.setFlag(Scala2xPartiallyAugmented)
68-
mixin.transformAfter(thisPhase, d => { d.setFlag(Scala2xPartiallyAugmented); d })
67+
mixin.setFlagFrom(thisPhase, Scala2xPartiallyAugmented)
6968
}
7069
}

compiler/src/dotty/tools/dotc/transform/PostTyper.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
118118
// if you would use parent param-name `a` to implement param-field `b`
119119
// overriding field `b` will actually override field `a`, that is wrong!
120120
typr.println(i"super alias: ${sym.showLocated}")
121-
sym.setFlag(SuperParamAlias)
121+
sym.setFlagFrom(thisPhase, SuperParamAlias)
122122
case _ =>
123123
case _ =>
124124

0 commit comments

Comments
 (0)