Prioritise nominal equalities
The main payload of this patch is * Prioritise nominal equalities in the constraint solver. This ameliorates the incompleteness of solving for representational constraints over newtypes: see #24887. See (EX2) in Note [Decomposing newtype equalities] in GHC.Tc.Solver.Equality In doing this patch I tripped over some other things that I refactored: * Move `isCoVarType` from `GHC.Core.Type` to `GHC.Core.Predicate` where it seems more at home. * Clarify the "rewrite role" of a constraint. I was very puzzled about what the role of, say `(Eq a)` might be, but see the new Note [The rewrite-role of a constraint]. In doing so I made predTypeEqRel crash when given a non-equality. Usually it expects an equality; but it was being mis-used for the above rewrite-role stuff.
Showing
- compiler/GHC/Core/Lint.hs 1 addition, 0 deletionscompiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Make.hs 4 additions, 3 deletionscompiler/GHC/Core/Make.hs
- compiler/GHC/Core/Predicate.hs 48 additions, 16 deletionscompiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/SimpleOpt.hs 11 additions, 6 deletionscompiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Type.hs 1 addition, 13 deletionscompiler/GHC/Core/Type.hs
- compiler/GHC/Core/Utils.hs 1 addition, 0 deletionscompiler/GHC/Core/Utils.hs
- compiler/GHC/Tc/Solver/Dict.hs 1 addition, 1 deletioncompiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs 23 additions, 5 deletionscompiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs 67 additions, 30 deletionscompiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Rewrite.hs 14 additions, 6 deletionscompiler/GHC/Tc/Solver/Rewrite.hs
- compiler/GHC/Tc/Solver/Solve.hs 7 additions, 4 deletionscompiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/Types.hs 2 additions, 3 deletionscompiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Types/Constraint.hs 29 additions, 8 deletionscompiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Types/Id.hs 12 additions, 7 deletionscompiler/GHC/Types/Id.hs
- testsuite/tests/typecheck/should_compile/T24887.hs 62 additions, 0 deletionstestsuite/tests/typecheck/should_compile/T24887.hs
- testsuite/tests/typecheck/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/typecheck/should_compile/all.T
Loading
Please register or sign in to comment