[commit: ghc] master: Instances in no-evidence implications (32eb419)
git at git.haskell.org
git at git.haskell.org
Fri Jun 22 12:11:37 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/32eb41994f7448caf5fb6b06ed0678d79d029deb/ghc
>---------------------------------------------------------------
commit 32eb41994f7448caf5fb6b06ed0678d79d029deb
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri Jun 22 11:27:47 2018 +0100
Instances in no-evidence implications
Trac #15290 showed that it's possible that we might attempt to use a
quantified constraint to solve an equality in a situation where we
don't have anywhere to put the evidence bindings. This made GHC crash.
This patch stops the crash, but still rejects the pogram. See
Note [Instances in no-evidence implications] in TcInteract.
Finding this bug revealed another lurking bug:
* An infelicity in the treatment of superclasses -- we were expanding
them locally at the leaves, rather than at their binding site; see
(3a) in Note [The superclass story].
As a consequence, TcRnTypes.superclassesMightHelp must look inside
implications.
In more detail:
* Stop the crash, by making TcInteract.chooseInstance test for
the no-evidence-bindings case. In that case we simply don't
use the instance. This entailed a slight change to the type
of chooseInstance.
* Make TcSMonad.getPendingScDicts (now renamed getPendingGivenScs)
return only Givens from the /current level/; and make
TcRnTypes.superClassesMightHelp look inside implications.
* Refactor the simpl_loop and superclass-expansion stuff in
TcSimplify. The logic is much easier to understand now, and
has less duplication.
>---------------------------------------------------------------
32eb41994f7448caf5fb6b06ed0678d79d029deb
compiler/typecheck/TcCanonical.hs | 9 ++
compiler/typecheck/TcInteract.hs | 46 +++++--
compiler/typecheck/TcRnTypes.hs | 28 ++++-
compiler/typecheck/TcSMonad.hs | 46 ++++---
compiler/typecheck/TcSimplify.hs | 134 +++++++++------------
testsuite/tests/quantified-constraints/T15290.hs | 35 ++++++
testsuite/tests/quantified-constraints/T15290a.hs | 35 ++++++
.../tests/quantified-constraints/T15290a.stderr | 22 ++++
testsuite/tests/quantified-constraints/all.T | 3 +
.../typecheck/should_fail/TcCoercibleFail.stderr | 3 +-
10 files changed, 252 insertions(+), 109 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 32eb41994f7448caf5fb6b06ed0678d79d029deb
More information about the ghc-commits
mailing list