We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 70e5c70 commit da6fbf8Copy full SHA for da6fbf8
compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
@@ -511,13 +511,16 @@ trait ConstraintHandling[AbstractContext] {
511
constraint.entry(bound) match {
512
case NoType => pruneLambdaParams(bound)
513
case _: TypeBounds =>
514
- if (ctx.mode.is(Mode.ConstrainResult))
+ val savedConstraint = constraint
515
+ val added = addParamBound(bound)
516
+ if (!added)
517
+ NoType
518
+ else if (constraint != savedConstraint && ctx.mode.is(Mode.ConstrainResult)) {
519
+ constraint = savedConstraint
520
NoType
- else {
- if (!addParamBound(bound)) NoType
- else if (fromBelow) defn.NothingType
- else defn.AnyType
521
}
522
+ else if (fromBelow) defn.NothingType
523
+ else defn.AnyType
524
case inst =>
525
prune(inst)
526
0 commit comments