Skip to content

Commit d26f1f4

Browse files
committed
Weaken assertion
Turns out there are more situations where we can get junk in constraints, and in at least one of them (i7969.scala) this happens before errors are reported. So, it's better to just reject junk types and return false in addConstraint.
1 parent da044ba commit d26f1f4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,7 @@ trait ConstraintHandling {
484484
* way isSubType is organized.
485485
*/
486486
protected def addConstraint(param: TypeParamRef, bound: Type, fromBelow: Boolean)(using Context): Boolean =
487-
if !bound.isValueTypeOrLambda then
488-
assert(ctx.reporter.errorsReported)
489-
return false
487+
if !bound.isValueTypeOrLambda then return false
490488

491489
/** When comparing lambdas we might get constraints such as
492490
* `A <: X0` or `A = List[X0]` where `A` is a constrained parameter

0 commit comments

Comments
 (0)