[commit: ghc] ghc-8.2: Fix bug in the short-cut solver (0461305)
git at git.haskell.org
git at git.haskell.org
Tue Oct 10 18:55:37 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.2
Link : http://ghc.haskell.org/trac/ghc/changeset/046130558d825dd05734238c8c87bae4a148bdc1/ghc
>---------------------------------------------------------------
commit 046130558d825dd05734238c8c87bae4a148bdc1
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Mon Oct 2 15:58:46 2017 +0100
Fix bug in the short-cut solver
Trac #13943 showed that the relatively-new short-cut solver
for class constraints (aka -fsolve-constant-dicts) was wrong.
In particular, see "Type families" under Note [Shortcut solving]
in TcInteract.
The short-cut solver recursively solves sub-goals, but it doesn't
flatten type-family applications, and as a result it erroneously
thought that C (F a) cannot possibly match (C 0), which is
simply untrue. That led to an inifinte loop in the short-cut
solver.
The significant change is the one line
+ , all isTyFamFree preds -- See "Type families" in
+ -- Note [Shortcut solving]
but, as ever, I do some other refactoring. (E.g. I changed the
name of the function to shortCutSolver rather than the more
generic trySolveFromInstance.)
I also made the short-cut solver respect the solver-depth limit,
so that if this happens again it won't just produce an infinite
loop.
A bit of other refactoring, notably moving isTyFamFree
from TcValidity to TcType
(cherry picked from commit a8fde1831f4b99885b8ed444f9cd7dffd9252150)
>---------------------------------------------------------------
046130558d825dd05734238c8c87bae4a148bdc1
compiler/typecheck/TcInteract.hs | 139 +++++++++++++--------
compiler/typecheck/TcType.hs | 8 +-
compiler/typecheck/TcValidity.hs | 4 -
testsuite/tests/typecheck/should_compile/T13943.hs | 68 ++++++++++
testsuite/tests/typecheck/should_compile/all.T | 1 +
5 files changed, 161 insertions(+), 59 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 046130558d825dd05734238c8c87bae4a148bdc1
More information about the ghc-commits
mailing list