Kill floatEqualities completely
This patch delivers on #17656, by entirel killing off the complex floatEqualities mechanism. Previously, floatEqualities would float an equality out of an implication, so that it could be solved at an outer level. But now we simply do unification in-place, without floating the constraint, relying on level numbers to determine untouchability. There are a number of important new Notes: * GHC.Tc.Utils.Unify Note [Unification preconditions] describes the preconditions for unification, including both skolem-escape and touchability. * GHC.Tc.Solver.Interact Note [Solve by unification] describes what we do when we do unify * GHC.Tc.Solver.Monad Note [The Unification Level Flag] describes how we control solver iteration under this new scheme * GHC.Tc.Solver.Monad Note [Tracking Given equalities] describes how we track when we have Given equalities * GHC.Tc.Types.Constraint Note [HasGivenEqs] is a new explanation of the ic_given_eqs field of an implication A big raft of subtle Notes in Solver, concerning floatEqualities, disappears. Main code changes: * GHC.Tc.Solver.floatEqualities disappears entirely * GHC.Tc.Solver.Monad: new fields in InertCans, inert_given_eq_lvl and inert_given_eq, updated by updateGivenEqs See Note [Tracking Given equalities]. * In exchange for updateGivenEqa, GHC.Tc.Solver.Monad.getHasGivenEqs is much simpler and more efficient * I found I could kill of metaTyVarUpdateOK entirely One test case T14683 showed a 4.5% decrease in compile-time allocation. Other changes were small Metric Decrease: T14683
Showing
- compiler/GHC/Runtime/Heap/Inspect.hs 1 addition, 1 deletioncompiler/GHC/Runtime/Heap/Inspect.hs
- compiler/GHC/Tc/Errors.hs 3 additions, 3 deletionscompiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Gen/App.hs 1 addition, 1 deletioncompiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/HsType.hs 2 additions, 2 deletionscompiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Solver.hs 85 additions, 393 deletionscompiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/Solver/Canonical.hs 94 additions, 23 deletionscompiler/GHC/Tc/Solver/Canonical.hs
- compiler/GHC/Tc/Solver/Interact.hs 74 additions, 27 deletionscompiler/GHC/Tc/Solver/Interact.hs
- compiler/GHC/Tc/Solver/Monad.hs 360 additions, 201 deletionscompiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Types/Constraint.hs 50 additions, 37 deletionscompiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Utils/Monad.hs 1 addition, 1 deletioncompiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs 25 additions, 23 deletionscompiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/TcType.hs 23 additions, 10 deletionscompiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/Tc/Utils/Unify.hs 185 additions, 182 deletionscompiler/GHC/Tc/Utils/Unify.hs
- testsuite/tests/ghci.debugger/scripts/break012.stdout 7 additions, 7 deletionstestsuite/tests/ghci.debugger/scripts/break012.stdout
- testsuite/tests/partial-sigs/should_compile/T10403.stderr 6 additions, 23 deletionstestsuite/tests/partial-sigs/should_compile/T10403.stderr
- testsuite/tests/partial-sigs/should_compile/T14715.stderr 6 additions, 7 deletionstestsuite/tests/partial-sigs/should_compile/T14715.stderr
- testsuite/tests/partial-sigs/should_fail/ScopedNamedWildcardsBad.stderr 9 additions, 4 deletions...s/partial-sigs/should_fail/ScopedNamedWildcardsBad.stderr
- testsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr 1 addition, 1 deletiontestsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr
- testsuite/tests/typecheck/should_fail/T7453.stderr 36 additions, 12 deletionstestsuite/tests/typecheck/should_fail/T7453.stderr
Loading
Please register or sign in to comment