[Git][ghc/ghc][master] 3 commits: Add test case for #25679
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 5e0ec555 by sheaf at 2026-01-28T06:56:38-05:00 Add test case for #25679 This commit adds the T25679 test case. The test now passes, thanks to commit 1e53277af36d3f0b6ad5491f70ffc5593a49dcfd. Fixes #25679 - - - - - f1cd1611 by sheaf at 2026-01-28T06:56:38-05:00 Improve defaulting of representational equalities This commit makes the defaulting of representational equalities, introduced in 1e53277a, a little bit more robust. Now, instead of calling the eager unifier, it calls the full-blown constraint solver, which means that it can handle some subtle situations, e.g. involving functional dependencies and type-family injectivity annotations, such as: type family F a = r | r -> a type instance F Int = Bool [W] F beta ~R Bool - - - - - 25edf516 by sheaf at 2026-01-28T06:56:38-05:00 Improve errors for unsolved representational equalities This commit adds a new field of CtLoc, CtExplanations, which allows the typechecker to leave some information about what it has done. For the moment, it is only used to improve error messages for unsolved representational equalities. The typechecker will now accumulate, when unifying at representational role: - out-of-scope newtype constructors, - type constructors that have nominal role in a certain argument, - over-saturated type constructors, - AppTys, e.g. `c a ~R# c b`, to report that we must assume that 'c' has nominal role in its parameters, - data family applications that do not reduce, potentially preventing newtype unwrapping. Now, instead of having to re-construct the possible errors after the fact, we simply consult the CtExplanations field. Additionally, this commit modifies the typechecker error messages that concern out-of-scope newtype constructors. The error message now depends on whether we have an import suggestion to provide to the user: - If we have an import suggestion for the newtype constructor, the message will be of the form: The data constructor MkN of the newtype N is out of scope Suggested fix: add 'MkN' to the import list in the import of 'M' - If we don't have any import suggestions, the message will be of the form: NB: The type 'N' is an opaque newtype, whose constructor is hidden Fixes #15850, #20289, #20468, #23731, #25949, #26137 - - - - - 67 changed files: - compiler/GHC/Core/Coercion.hs - compiler/GHC/Core/FamInstEnv.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Core/TyCon/RecWalk.hs - compiler/GHC/Data/Maybe.hs - compiler/GHC/HsToCore/Pmc/Solver.hs - compiler/GHC/Rename/Unbound.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Instance/Family.hs - compiler/GHC/Tc/Solver/Default.hs - compiler/GHC/Tc/Solver/Equality.hs - compiler/GHC/Tc/Types/Constraint.hs - compiler/GHC/Tc/Types/CtLoc.hs - compiler/GHC/Tc/Types/Origin.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Tc/Zonk/TcType.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Types/RepType.hs - compiler/GHC/Utils/Monad.hs - libraries/base/tests/T23454.stderr - + testsuite/tests/default/T25825.hs - testsuite/tests/default/all.T - testsuite/tests/deriving/should_fail/T1496.stderr - testsuite/tests/deriving/should_fail/T4846.stderr - testsuite/tests/deriving/should_fail/T5498.stderr - testsuite/tests/deriving/should_fail/T6147.stderr - testsuite/tests/deriving/should_fail/T7148.stderr - testsuite/tests/deriving/should_fail/T7148a.stderr - testsuite/tests/deriving/should_fail/T8984.stderr - testsuite/tests/deriving/should_fail/deriving-via-fail.stderr - testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr - testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr - testsuite/tests/gadt/CasePrune.stderr - testsuite/tests/indexed-types/should_fail/T9580.stderr - testsuite/tests/linear/should_fail/LinearRole.stderr - testsuite/tests/roles/should_fail/RolesIArray.stderr - testsuite/tests/typecheck/should_fail/T10285.stderr - testsuite/tests/typecheck/should_fail/T10534.stderr - testsuite/tests/typecheck/should_fail/T10715b.stderr - testsuite/tests/typecheck/should_fail/T11347.stderr - testsuite/tests/typecheck/should_fail/T15801.stderr - + testsuite/tests/typecheck/should_fail/T15850.hs - + testsuite/tests/typecheck/should_fail/T15850.stderr - + testsuite/tests/typecheck/should_fail/T15850_Lib.hs - + testsuite/tests/typecheck/should_fail/T20289.hs - + testsuite/tests/typecheck/should_fail/T20289.stderr - + testsuite/tests/typecheck/should_fail/T20289_A.hs - testsuite/tests/typecheck/should_fail/T22645.stderr - testsuite/tests/typecheck/should_fail/T22924a.stderr - + testsuite/tests/typecheck/should_fail/T23731.hs - + testsuite/tests/typecheck/should_fail/T23731.stderr - + testsuite/tests/typecheck/should_fail/T23731b.hs - + testsuite/tests/typecheck/should_fail/T23731b.stderr - + testsuite/tests/typecheck/should_fail/T23731b_aux.hs - + testsuite/tests/typecheck/should_fail/T25679.hs - + testsuite/tests/typecheck/should_fail/T25679.stderr - + testsuite/tests/typecheck/should_fail/T25949.hs - + testsuite/tests/typecheck/should_fail/T25949.stderr - + testsuite/tests/typecheck/should_fail/T25949_aux.hs - + testsuite/tests/typecheck/should_fail/T26137.hs - + testsuite/tests/typecheck/should_fail/T26137.stderr - testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr - testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr - testsuite/tests/typecheck/should_fail/all.T The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ef35e3ea14d56e1bcd43e3985c33dbe... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ef35e3ea14d56e1bcd43e3985c33dbe... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)