Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restrict widening MatchTypes to its bounds
During match type reduction, if we're going to allow approximating we must further restrict match types from widening to its bound. Failing to do so will record GADT constraint bounds that parameters will be approximated to, which is lossy and leads to a loss of type checking completion.. For instance, in a variant of i13633 with an added `<: (Boolean, Boolean)` bound to `PlusTri`, when reducing `PlusTri[a, b, O] match { case (x, y) => ... }`, widening the expansion of `PlusTri[a, b, O]` to its bound `(Boolean, Boolean)`, causes the recording the constraints bounds `x >: Boolean` and `y >: Boolean` and then reduction instantiates `x` and `y` to Boolean, losing the precision that comes from `a`, `b`, and `O`. This came up while implementing bounds checking to match type case bodies, and requires an important fix to PatternTypeConstrainer (the use of typeSymbol's) so the tests that require this are part of that effort.
- Loading branch information