Skip to content

Commit 918a3fb

Browse files
committed
Add more explanation.
1 parent 2144462 commit 918a3fb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
381381
// where the subtype relation is true without needing to add a constraint
382382
// It's tricky because we might need to either appriximate tp2 by its
383383
// lower bound or else widen tp1 and check that the result is a subtype of tp2.
384+
// So if the constraint is not yet frozen, we do the same comparison again
385+
// with a frozen constraint, which means that we get a chance to do the
386+
// widening in `fourthTry` before adding to the constraint.
384387
if (frozenConstraint || alwaysFluid) isSubType(tp1, bounds(tp2).lo)
385388
else isSubTypeWhenFrozen(tp1, tp2)
386389
alwaysTrue || {

0 commit comments

Comments
 (0)