Commit Graph

2 Commits

Author SHA1 Message Date
Hamish Knight
7a137d6756 [CS] Allow ExprPatterns to be type-checked in the solver
Previously we would wait until CSApply, which
would trigger their type-checking in
`coercePatternToType`. This caused a number of
bugs, and hampered solver-based completion, which
does not run CSApply. Instead, form a conjunction
of all the ExprPatterns present, which preserves
some of the previous isolation behavior (though
does not provide complete isolation).

We can then modify `coercePatternToType` to accept
a closure, which allows the solver to take over
rewriting the ExprPatterns it has already solved.

This then sets the stage for the complete removal
of `coercePatternToType`, and doing all pattern
type-checking in the solver.
2023-06-07 00:35:01 +01:00
Hamish Knight
6a7878b90d [CS] Perform limited exhaustiveness checking if we couldn't apply the solution
Currently ExprPatterns are type-checked during
CSApply. As such, they can cause solution
application to fail with a pattern that isn't
well-formed. I'm planning on moving their
type-checking into the solver, but until then,
lets only do limited exhaustiveness checking for
the switch if there was an error.

rdar://105781521
2023-03-01 16:20:13 +00:00