Skip to content

Commit 82c0026

Browse files
committed
Add a case where caching was missing.
Gave several times improvement for linker.
1 parent c676d7d commit 82c0026

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,7 @@ object SymDenotations {
16411641
*/
16421642
def isCachable(tp: Type): Boolean = tp match {
16431643
case _: TypeErasure.ErasedValueType => false
1644+
case tp: TypeRef if tp.symbol.isClass => true
16441645
case tp: TypeVar => tp.inst.exists && inCache(tp.inst)
16451646
case tp: TypeProxy => inCache(tp.underlying)
16461647
case tp: AndOrType => inCache(tp.tp1) && inCache(tp.tp2)

src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
8989
assert(isSatisfiable, constraint.show)
9090
}
9191

92-
protected def isSubType(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubType ${traceInfo(tp1, tp2)}", subtyping) /*<|<*/ {
92+
protected def isSubType(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubType ${traceInfo(tp1, tp2)}", subtyping) {
9393
if (tp2 eq NoType) false
9494
else if (tp1 eq tp2) true
9595
else {
@@ -377,14 +377,15 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
377377
}
378378
compareRefined
379379
case tp2: RecType =>
380-
tp1.safeDealias match {
380+
def compareRec = tp1.safeDealias match {
381381
case tp1: RecType =>
382382
val rthis1 = RecThis(tp1)
383383
isSubType(tp1.parent, tp2.parent.substRecThis(tp2, rthis1))
384384
case _ =>
385385
val tp1stable = ensureStableSingleton(tp1)
386386
isSubType(fixRecs(tp1stable, tp1stable.widenExpr), tp2.parent.substRecThis(tp2, tp1stable))
387-
}
387+
}
388+
compareRec
388389
case tp2 @ HKApply(tycon2, args2) =>
389390
compareHkApply2(tp1, tp2, tycon2, args2)
390391
case tp2 @ TypeLambda(tparams2, body2) =>

0 commit comments

Comments
 (0)