Skip to content

Commit 70e5c70

Browse files
committed
In ConstrainResult mode, prefer widening over narrowing bounds
The same should also probably be done in GADT mode.
1 parent 1564329 commit 70e5c70

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,13 @@ trait ConstraintHandling[AbstractContext] {
511511
constraint.entry(bound) match {
512512
case NoType => pruneLambdaParams(bound)
513513
case _: TypeBounds =>
514-
if (!addParamBound(bound)) NoType
515-
else if (fromBelow) defn.NothingType
516-
else defn.AnyType
514+
if (ctx.mode.is(Mode.ConstrainResult))
515+
NoType
516+
else {
517+
if (!addParamBound(bound)) NoType
518+
else if (fromBelow) defn.NothingType
519+
else defn.AnyType
520+
}
517521
case inst =>
518522
prune(inst)
519523
}

0 commit comments

Comments
 (0)