Skip to content

Commit d924ef1

Browse files
committed
More precise derivesFrom for MatchTypes
Need to take possible reductions into account.
1 parent dc669a6 commit d924ef1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ object Types {
208208
case tp: TypeRef =>
209209
val sym = tp.symbol
210210
if (sym.isClass) sym.derivesFrom(cls) else loop(tp.superType): @tailrec
211+
case tp: AppliedType =>
212+
tp.superType.derivesFrom(cls)
213+
case tp: MatchType =>
214+
tp.bound.derivesFrom(cls) || tp.reduced.derivesFrom(cls)
211215
case tp: TypeProxy =>
212216
loop(tp.underlying): @tailrec
213217
case tp: AndType =>

0 commit comments

Comments
 (0)