Skip to content

Commit 0b5005d

Browse files
committed
Avoid creating set on each call
1 parent c3228d6 commit 0b5005d

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4248,15 +4248,6 @@ object Types {
42484248
case _ => None
42494249
}
42504250

4251-
val opsSet = Set(
4252-
defn.CompiletimeOpsAnyModuleClass,
4253-
defn.CompiletimeOpsIntModuleClass,
4254-
defn.CompiletimeOpsLongModuleClass,
4255-
defn.CompiletimeOpsFloatModuleClass,
4256-
defn.CompiletimeOpsBooleanModuleClass,
4257-
defn.CompiletimeOpsStringModuleClass
4258-
)
4259-
42604251
// Returns Some(true) if the type is a constant.
42614252
// Returns Some(false) if the type is not a constant.
42624253
// Returns None if there is not enough information to determine if the type is a constant.
@@ -4272,7 +4263,7 @@ object Types {
42724263
// constant if the term is constant
42734264
case t: TermRef => isConst(t.underlying)
42744265
// an operation type => recursively check all argument compositions
4275-
case applied: AppliedType if opsSet.contains(applied.typeSymbol.owner) =>
4266+
case applied: AppliedType if defn.isCompiletimeAppliedType(applied.typeSymbol) =>
42764267
val argsConst = applied.args.map(isConst)
42774268
if (argsConst.exists(_.isEmpty)) None
42784269
else Some(argsConst.forall(_.get))

0 commit comments

Comments
 (0)