Skip to content

Commit 94f3f0c

Browse files
committed
Simplify some more
1 parent aca3133 commit 94f3f0c

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

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

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ trait ConstraintHandling[AbstractContext] {
422422
def description = i"constr $param ${if (fromBelow) ">:" else "<:"} $bound:\n$constraint"
423423
//checkPropagated(s"adding $description")(true) // DEBUG in case following fails
424424
checkPropagated(s"added $description") {
425-
addConstraintInvocations += 1
426425

427426
/** When comparing lambdas we might get constraints such as
428427
* `A <: X0` or `A = List[X0]` where `A` is a constrained parameter
@@ -511,29 +510,15 @@ trait ConstraintHandling[AbstractContext] {
511510
|| tp1.hasAnyKind
512511
|| tp2.hasAnyKind
513512

514-
try bound match {
513+
addConstraintInvocations += 1
514+
try bound match
515515
case bound: TypeParamRef if constraint contains bound =>
516516
addParamBound(bound)
517517
case _ =>
518-
val savedConstraint = constraint
519518
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))
537522
finally addConstraintInvocations -= 1
538523
}
539524
}

0 commit comments

Comments
 (0)