Speed up valid hole-fits by adding early abort and checks.
By adding an early abort flag in `TcSEnv`, we can fail fast in the presence of insoluble constraints. This helps us avoid a lot of work in valid hole-fits, and we geta massive speed-up by avoiding a lot of useless work solving constraints that never come into play. Additionally, we add a simple check for degenerate hole types, such as when the type of the hole is an immutable type variable (as is the case when the hole is completely unconstrained). Then the only valid fits are the locals, so we can ignore the global candidates. This fixes #16875
Showing
- compiler/GHC/Tc/Errors/Hole.hs 60 additions, 35 deletionscompiler/GHC/Tc/Errors/Hole.hs
- compiler/GHC/Tc/Solver.hs 5 additions, 1 deletioncompiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/Solver/Monad.hs 43 additions, 25 deletionscompiler/GHC/Tc/Solver/Monad.hs
- testsuite/tests/typecheck/should_compile/T16875.hs 13 additions, 0 deletionstestsuite/tests/typecheck/should_compile/T16875.hs
- testsuite/tests/typecheck/should_compile/T16875.stderr 12 additions, 0 deletionstestsuite/tests/typecheck/should_compile/T16875.stderr
- testsuite/tests/typecheck/should_compile/all.T 6 additions, 0 deletionstestsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_compile/hard_hole_fits.hs 48 additions, 0 deletionstestsuite/tests/typecheck/should_compile/hard_hole_fits.hs
- testsuite/tests/typecheck/should_compile/hard_hole_fits.stderr 674 additions, 0 deletions...uite/tests/typecheck/should_compile/hard_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/refinement_hole_fits.hs 3 additions, 0 deletions...te/tests/typecheck/should_compile/refinement_hole_fits.hs
- testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr 25 additions, 0 deletions...ests/typecheck/should_compile/refinement_hole_fits.stderr
Loading
Please register or sign in to comment