File tree 1 file changed +6
-2
lines changed
compiler/src/dotty/tools/dotc/core
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1498,10 +1498,14 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
1498
1498
* Delegates to compareS if `tycon` is scala.compiletime.S. Otherwise, constant folds if possible.
1499
1499
*/
1500
1500
def compareCompiletimeAppliedType (tp : AppliedType , other : Type , fromBelow : Boolean ): Boolean = {
1501
- if ( defn.isCompiletime_S(tp.tycon.typeSymbol)) compareS(tp, other, fromBelow)
1502
- else {
1501
+ defn.isCompiletime_S(tp.tycon.typeSymbol) && compareS(tp, other, fromBelow)
1502
+ || {
1503
1503
val folded = tp.tryCompiletimeConstantFold
1504
1504
if (fromBelow) recur(other, folded) else recur(folded, other)
1505
+ } || other.match {
1506
+ case other : TypeRef if ! fromBelow && other.symbol == defn.SingletonClass =>
1507
+ true // Even if not declared, the result of a compiletime operator is a constant type
1508
+ case _ => false
1505
1509
}
1506
1510
}
1507
1511
You can’t perform that action at this time.
0 commit comments