[commit: ghc] ghc-8.6: Instances in no-evidence implications (61adfbe)
git at git.haskell.org
git at git.haskell.org
Wed Jun 27 21:09:35 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.6
Link : http://ghc.haskell.org/trac/ghc/changeset/61adfbe6f9926daf06031b7da2522f73addf75dc/ghc
>---------------------------------------------------------------
commit 61adfbe6f9926daf06031b7da2522f73addf75dc
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.
(cherry picked from commit 32eb41994f7448caf5fb6b06ed0678d79d029deb)
>---------------------------------------------------------------
61adfbe6f9926daf06031b7da2522f73addf75dc
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 +
9 files changed, 251 insertions(+), 107 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 61adfbe6f9926daf06031b7da2522f73addf75dc
More information about the ghc-commits
mailing list