Skip to content

Commit 825f7eb

Browse files
committed
Handle Java raw types in isSubType
We were missing the case where a supertype is an unapplied Java type constructor. Such a type is not a higher-kinded type, but a raw type.
1 parent 2b333ba commit 825f7eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,10 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
371371
val cls2 = tp2.symbol
372372
if (cls2.isClass) {
373373
val base = tp1.baseType(cls2)
374-
if (base.exists && (base ne tp1)) return isSubType(base, tp2)
374+
if (base.exists) {
375+
if (cls2.is(JavaDefined)) return base.typeSymbol == cls2
376+
if (base ne tp1) return isSubType(base, tp2)
377+
}
375378
if (cls2 == defn.SingletonClass && tp1.isStable) return true
376379
}
377380
fourthTry(tp1, tp2)

0 commit comments

Comments
 (0)