[Git][ghc/ghc][wip/backport-MR951] Fix #16517 by bumping the TcLevel for method sigs

Ben Gamari gitlab at gitlab.haskell.org
Thu Jun 20 03:31:25 UTC 2019



Ben Gamari pushed to branch wip/backport-MR951 at Glasgow Haskell Compiler / GHC


Commits:
48dfe535 by Richard Eisenberg at 2019-06-20T03:30:53Z
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)

- - - - -


30 changed files:

- 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/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/VtaFail.stderr
- testsuite/tests/typecheck/should_fail/all.T
- testsuite/tests/typecheck/should_fail/tcfail057.stderr
- testsuite/tests/typecheck/should_fail/tcfail058.stderr
- testsuite/tests/typecheck/should_fail/tcfail063.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/48dfe535174a03da2cacc70e40accf005f6faf15

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/48dfe535174a03da2cacc70e40accf005f6faf15
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/20190619/63032401/attachment.html>


More information about the ghc-commits mailing list