Skip to content

Commit ee1eadb

Browse files
committed
Apply refactorings blocked previously
Apply refactorings that were not possible before because bootstrap compiler had problems with them.
1 parent 4a107cc commit ee1eadb

File tree

4 files changed

+13
-32
lines changed

4 files changed

+13
-32
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ object Flags {
2020
opaque type Flag <: FlagSet = Long
2121
private[Flags] def Flag(bits: Long): Flag = bits
2222
}
23-
type FlagSet = opaques.FlagSet
24-
def FlagSet(bits: Long): FlagSet = opaques.FlagSet(bits)
25-
// DOTTY TODO: replace previous 2 lines with
26-
// export opaques.FlagSet
27-
// once 0.17 is released and #6721 is in the bootstrap
23+
export opaques.FlagSet
2824

2925
type Flag = opaques.Flag
3026

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

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -187,46 +187,34 @@ object SymDenotations {
187187
if (isCurrent(fs)) myFlags else flags
188188

189189
/** Has this denotation one of given flag set? */
190-
final def is(flag: Flag)(implicit ctx: Context): Boolean = {
191-
val toTest = if (isCurrent(flag)) myFlags else flags // TODO: combine these two lines once 0.17 is released and #6706 is in
192-
toTest.is(flag)
193-
}
190+
final def is(flag: Flag)(implicit ctx: Context): Boolean =
191+
(if (isCurrent(flag)) myFlags else flags).is(flag)
194192

195193
/** Has this denotation one of the flags in `fs` set? */
196-
final def isOneOf(fs: FlagSet)(implicit ctx: Context): Boolean = {
197-
val toTest = if (isCurrent(fs)) myFlags else flags // TODO: combine these two lines once 0.17 is released and #6706 is in
198-
toTest.isOneOf(fs)
199-
}
194+
final def isOneOf(fs: FlagSet)(implicit ctx: Context): Boolean =
195+
(if (isCurrent(fs)) myFlags else flags).isOneOf(fs)
200196

201197
/** Has this denotation the given flag set, whereas none of the flags
202198
* in `butNot` are set?
203199
*/
204-
final def is(flag: Flag, butNot: FlagSet)(implicit ctx: Context): Boolean = {
205-
val toTest = if (isCurrent(flag) && isCurrent(butNot)) myFlags else flags // TODO: combine these two lines once 0.17 is released and #6706 is in
206-
toTest.is(flag, butNot)
207-
}
200+
final def is(flag: Flag, butNot: FlagSet)(implicit ctx: Context): Boolean =
201+
(if (isCurrent(flag) && isCurrent(butNot)) myFlags else flags).is(flag, butNot)
208202

209203
/** Has this denotation one of the flags in `fs` set, whereas none of the flags
210204
* in `butNot` are set?
211205
*/
212-
final def isOneOf(fs: FlagSet, butNot: FlagSet)(implicit ctx: Context): Boolean = {
213-
val toTest = if (isCurrent(fs) && isCurrent(butNot)) myFlags else flags // TODO: combine these two lines once 0.17 is released and #6706 is in
214-
toTest.isOneOf(fs, butNot)
215-
}
206+
final def isOneOf(fs: FlagSet, butNot: FlagSet)(implicit ctx: Context): Boolean =
207+
(if (isCurrent(fs) && isCurrent(butNot)) myFlags else flags).isOneOf(fs, butNot)
216208

217209
/** Has this denotation all of the flags in `fs` set? */
218-
final def isAllOf(fs: FlagSet)(implicit ctx: Context): Boolean = {
219-
val toTest = if (isCurrent(fs)) myFlags else flags // TODO: combine these two lines once 0.17 is released and #6706 is in
220-
toTest.isAllOf(fs)
221-
}
210+
final def isAllOf(fs: FlagSet)(implicit ctx: Context): Boolean =
211+
(if (isCurrent(fs)) myFlags else flags).isAllOf(fs)
222212

223213
/** Has this denotation all of the flags in `fs` set, whereas none of the flags
224214
* in `butNot` are set?
225215
*/
226-
final def isAllOf(fs: FlagSet, butNot: FlagSet)(implicit ctx: Context): Boolean = {
227-
val toTest = if (isCurrent(fs) && isCurrent(butNot)) myFlags else flags // TODO: combine these two lines once 0.17 is released and #6706 is in
228-
toTest.isAllOf(fs, butNot)
229-
}
216+
final def isAllOf(fs: FlagSet, butNot: FlagSet)(implicit ctx: Context): Boolean =
217+
(if (isCurrent(fs) && isCurrent(butNot)) myFlags else flags).isAllOf(fs, butNot)
230218

231219
/** The type info, or, if symbol is not yet completed, the completer */
232220
final def infoOrCompleter: Type = myInfo

compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import dotty.tools.dotc.util.SourceFile
1717

1818
import scala.tasty.reflect.Kernel
1919

20-
import delegate Flags.FlagOps // DOTTY problem: this line can be dropped in 0.17 once #6712 is in bootstrap.
21-
2220
class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.SourcePosition) extends Kernel {
2321

2422
private implicit def ctx: core.Contexts.Context = rootContext

compiler/src/dotty/tools/dotc/typer/Variances.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package typer
33

44
import core._
55
import Types._, Contexts._, Flags._, Symbols._, Annotations._
6-
import delegate Flags.FlagOps // DOTTY problem: this line can be dropped in 0.17 once #6712 is in bootstrap.
76

87
object Variances {
98

0 commit comments

Comments
 (0)