Skip to content

Commit dd1f92a

Browse files
committed
Add a case where caching was missing.
Gave several times improvement for linker.
1 parent 34f4c49 commit dd1f92a

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
@@ -88,7 +88,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
8888
assert(isSatisfiable, constraint.show)
8989
}
9090

91-
protected def isSubType(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubType ${traceInfo(tp1, tp2)}", subtyping) /*<|<*/ {
91+
protected def isSubType(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubType ${traceInfo(tp1, tp2)}", subtyping) {
9292
if (tp2 eq NoType) false
9393
else if (tp1 eq tp2) true
9494
else {
@@ -374,14 +374,15 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
374374
}
375375
compareRefined
376376
case tp2: RecType =>
377-
tp1.safeDealias match {
377+
def compareRec = tp1.safeDealias match {
378378
case tp1: RecType =>
379379
val rthis1 = RecThis(tp1)
380380
isSubType(tp1.parent, tp2.parent.substRecThis(tp2, rthis1))
381381
case _ =>
382382
val tp1stable = ensureStableSingleton(tp1)
383383
isSubType(fixRecs(tp1stable, tp1stable.widenExpr), tp2.parent.substRecThis(tp2, tp1stable))
384-
}
384+
}
385+
compareRec
385386
case tp2 @ HKApply(tycon2, args2) =>
386387
compareHkApply2(tp1, tp2, tycon2, args2)
387388
case tp2 @ TypeLambda(tparams2, body2) =>

0 commit comments

Comments
 (0)