Allow defaulting of representational equalities
This commit generalises the defaulting of equality constraints that was introduced in 663daf8d (with follow-up in 6863503c) to allow the defaulting of *representational* equality constraints. Now we default a representational equality ty1 ~R# ty2 by unifying ty1 ~# ty2. This allows the following defaulting to take place: - Coercible alpha[tau] Int ==> alpha := Int - Coercible (IO beta[tau]) (IO Char) ==> beta := Char See Note [Defaulting representational equalities] in GHC.Tc.Solver.Default for more details. Fixes #21003
Showing
- compiler/GHC/Tc/Solver/Default.hs 129 additions, 20 deletionscompiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs 3 additions, 3 deletionscompiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs 4 additions, 0 deletionscompiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/Monad.hs 3 additions, 1 deletioncompiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Utils/Unify.hs 1 addition, 1 deletioncompiler/GHC/Tc/Utils/Unify.hs
- docs/users_guide/9.14.1-notes.rst 4 additions, 0 deletionsdocs/users_guide/9.14.1-notes.rst
- testsuite/tests/default/default-fail08.hs 9 additions, 5 deletionstestsuite/tests/default/default-fail08.hs
- testsuite/tests/default/default-fail08.stderr 22 additions, 6 deletionstestsuite/tests/default/default-fail08.stderr
- testsuite/tests/rep-poly/T14561b.stderr 2 additions, 2 deletionstestsuite/tests/rep-poly/T14561b.stderr
- testsuite/tests/rep-poly/UnliftedNewtypesCoerceFail.stderr 2 additions, 2 deletionstestsuite/tests/rep-poly/UnliftedNewtypesCoerceFail.stderr
- testsuite/tests/typecheck/should_compile/T21003.hs 35 additions, 0 deletionstestsuite/tests/typecheck/should_compile/T21003.hs
- testsuite/tests/typecheck/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T10495.hs 3 additions, 2 deletionstestsuite/tests/typecheck/should_fail/T10495.hs
- testsuite/tests/typecheck/should_fail/T10495.stderr 4 additions, 7 deletionstestsuite/tests/typecheck/should_fail/T10495.stderr
Loading
Please register or sign in to comment