[Git][ghc/ghc][wip/T13786] 3 commits: Fail fast in solveLocalEqualities

Ben Gamari gitlab at gitlab.haskell.org
Fri Jun 14 21:21:20 UTC 2019



Ben Gamari pushed to branch wip/T13786 at Glasgow Haskell Compiler / GHC


Commits:
a03619a0 by Simon Peyton Jones at 2019-06-13T22:43:49Z
Fail fast in solveLocalEqualities

This patch makes us fail fast in TcSimplify.solveLocalEqualities,
and in TcHsType.tc_hs_sig_type, if there are insoluble constraints.

Previously we ploughed on even if there were insoluble constraints,
leading to a cascade of hard-to-understand type errors. Failing
eagerly is much better; hence a lot of testsuite error message
changes.  Eg if we have
          f :: [Maybe] -> blah
          f xs = e
then trying typecheck 'f x = e' with an utterly bogus type
is just asking for trouble.

I can't quite remember what provoked me to make this change,
but I think the error messages are notably improved, by
removing confusing clutter and focusing on the real error.

(cherry picked from commit 5c1f268e2744fab2d36e64c163858995451d7095)

- - - - -
5857463c by Richard Eisenberg at 2019-06-13T22:47:54Z
Fix #16517 by bumping the TcLevel for method sigs

There were actually two bugs fixed here:

1. candidateQTyVarsOfType needs to be careful that it does not
   try to zap metavariables from an outer scope as "naughty"
   quantification candidates. This commit adds a simple check
   to avoid doing so.

2. We weren't bumping the TcLevel in kcHsKindSig, which was used
   only for class method sigs. This mistake led to the acceptance
   of

     class C a where
       meth :: forall k. Proxy (a :: k) -> ()

   Note that k is *locally* quantified. This patch fixes the
   problem by using tcClassSigType, which correctly bumps the
   level. It's a bit inefficient because tcClassSigType does other
   work, too, but it would be tedious to repeat much of the code
   there with only a few changes. This version works well and is
   simple.

And, while updating comments, etc., I noticed that tcRnType was
missing a pushTcLevel, leading to #16767, which this patch also
fixes, by bumping the level. In the refactoring here, I also
use solveEqualities. This initially failed ghci/scripts/T15415,
but that was fixed by teaching solveEqualities to respect
-XPartialTypeSignatures.

This patch also cleans up some Notes around error generation that
came up in conversation.

Test case: typecheck/should_fail/T16517, ghci/scripts/T16767

(cherry picked from commit a22e51ea6f7a046c87d57ce30d143eef6abee9ff)
(cherry picked from commit 19ab32c5fb3ebd88927b94acf6b348facc1552a2)

- - - - -
ce97ca46 by Ben Gamari at 2019-06-14T21:20:39Z
ghci: Load static objects in batches

Fixes #13786.

- - - - -


30 changed files:

- compiler/ghci/Linker.hs
- compiler/typecheck/TcCanonical.hs
- compiler/typecheck/TcErrors.hs
- compiler/typecheck/TcHsType.hs
- compiler/typecheck/TcMType.hs
- compiler/typecheck/TcRnDriver.hs
- compiler/typecheck/TcRnTypes.hs
- compiler/typecheck/TcSimplify.hs
- compiler/typecheck/TcTyClsDecls.hs
- compiler/typecheck/TcType.hs
- testsuite/tests/dependent/should_fail/DepFail1.stderr
- testsuite/tests/ghci/scripts/T15898.stderr
- + testsuite/tests/ghci/scripts/T16767.script
- + testsuite/tests/ghci/scripts/T16767.stdout
- testsuite/tests/ghci/scripts/all.T
- testsuite/tests/indexed-types/should_fail/T13877.stderr
- testsuite/tests/partial-sigs/should_fail/T11976.stderr
- testsuite/tests/partial-sigs/should_fail/T12634.stderr
- testsuite/tests/patsyn/should_fail/T15289.stderr
- testsuite/tests/polykinds/T12593.stderr
- testsuite/tests/polykinds/T15577.stderr
- testsuite/tests/typecheck/should_fail/T11112.stderr
- testsuite/tests/typecheck/should_fail/T13819.stderr
- testsuite/tests/typecheck/should_fail/T14232.stderr
- + testsuite/tests/typecheck/should_fail/T16517.hs
- + testsuite/tests/typecheck/should_fail/T16517.stderr
- testsuite/tests/typecheck/should_fail/T3540.stderr
- testsuite/tests/typecheck/should_fail/T7778.stderr
- testsuite/tests/typecheck/should_fail/T8806.stderr
- testsuite/tests/typecheck/should_fail/VtaFail.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/383164c12904a8892a1624a6d84b1a10602e19c3...ce97ca46aa80035ea2c582f2b4613e07dfaecd90

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/383164c12904a8892a1624a6d84b1a10602e19c3...ce97ca46aa80035ea2c582f2b4613e07dfaecd90
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190614/692f9c1f/attachment.html>


More information about the ghc-commits mailing list