Skip to content

Commit b34bd61

Browse files
committed
Enhancement: Treat Any as a top type for comparisons.
It was already implied before, but so far an explicit rule that cs T <: Any was missing. Adding that rule is important for bounds checking.
1 parent 53996ab commit b34bd61

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
520520
res
521521

522522
case CapturingType(parent1, refs1) =>
523-
if subCaptures(refs1, tp2.captureSet, frozenConstraint).isOK && sameBoxed(tp1, tp2, refs1)
523+
if tp2.isAny then true
524+
else if subCaptures(refs1, tp2.captureSet, frozenConstraint).isOK && sameBoxed(tp1, tp2, refs1)
524525
then recur(parent1, tp2)
525526
else thirdTry
526527
case tp1: AnnotatedType if !tp1.isRefining =>

0 commit comments

Comments
 (0)