Skip to content

Commit 10f96b4

Browse files
committed
Small optimization
Flag `|` is not super-fast, so it might pay to compute this once ahead of time.
1 parent e42b83e commit 10f96b4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ object CheckRealizable {
5252

5353
def boundsRealizability(tp: Type)(implicit ctx: Context) =
5454
new CheckRealizable().boundsRealizability(tp)
55+
56+
private val LateInitialized = Lazy | Erased,
5557
}
5658

5759
/** Compute realizability status */
@@ -66,7 +68,7 @@ class CheckRealizable(implicit ctx: Context) {
6668
/** Is symbol's definitition a lazy or erased val?
6769
* (note we exclude modules here, because their realizability is ensured separately)
6870
*/
69-
private def isLateInitialized(sym: Symbol) = sym.is(Lazy | Erased, butNot = Module)
71+
private def isLateInitialized(sym: Symbol) = sym.is(LateInitialized, butNot = Module)
7072

7173
/** The realizability status of given type `tp`*/
7274
def realizability(tp: Type): Realizability = tp.dealias match {

0 commit comments

Comments
 (0)