@@ -422,7 +422,6 @@ trait ConstraintHandling[AbstractContext] {
422
422
def description = i " constr $param ${if (fromBelow) " >:" else " <:" } $bound: \n $constraint"
423
423
// checkPropagated(s"adding $description")(true) // DEBUG in case following fails
424
424
checkPropagated(s " added $description" ) {
425
- addConstraintInvocations += 1
426
425
427
426
/** When comparing lambdas we might get constraints such as
428
427
* `A <: X0` or `A = List[X0]` where `A` is a constrained parameter
@@ -511,29 +510,15 @@ trait ConstraintHandling[AbstractContext] {
511
510
|| tp1.hasAnyKind
512
511
|| tp2.hasAnyKind
513
512
514
- try bound match {
513
+ addConstraintInvocations += 1
514
+ try bound match
515
515
case bound : TypeParamRef if constraint contains bound =>
516
516
addParamBound(bound)
517
517
case _ =>
518
- val savedConstraint = constraint
519
518
val pbound = prune(pruneLambdaParams(bound))
520
- assert(constraint eq savedConstraint)
521
- val constraintsNarrowed = constraint ne savedConstraint
522
-
523
- val res =
524
- pbound.exists
525
- && kindCompatible(param, pbound)
526
- && (if fromBelow then addLowerBound(param, pbound) else addUpperBound(param, pbound))
527
- // If we're in `ConstrainResult` mode, we don't want to commit to a
528
- // set of constraints that would later prevent us from typechecking
529
- // arguments, so if `pruneParams` had to narrow the constraints, we
530
- // simply do not record any new constraint.
531
- // Unlike in `TypeComparer#either`, the same reasoning does not apply
532
- // to GADT mode because this code is never run on GADT constraints.
533
- if ctx.mode.is(Mode .ConstrainResult ) && constraintsNarrowed then
534
- constraint = savedConstraint
535
- res
536
- }
519
+ pbound.exists
520
+ && kindCompatible(param, pbound)
521
+ && (if fromBelow then addLowerBound(param, pbound) else addUpperBound(param, pbound))
537
522
finally addConstraintInvocations -= 1
538
523
}
539
524
}
0 commit comments