[commit: ghc] master: Enable lint checking of levity polymorphic coercions (f3af046)

git at git.haskell.org git at git.haskell.org
Thu Apr 6 21:44:33 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f3af0463c81002a64a3b3e9a01351e64460c490f/ghc

>---------------------------------------------------------------

commit f3af0463c81002a64a3b3e9a01351e64460c490f
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Thu Apr 6 16:38:45 2017 -0400

    Enable lint checking of levity polymorphic coercions
    
    This reverts commit 03c7dd0941fb4974be54026ef3e4bb97451c3b1f and fixes
    the coercions.


>---------------------------------------------------------------

f3af0463c81002a64a3b3e9a01351e64460c490f
 compiler/coreSyn/CoreLint.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
index 16edcb8..8182272 100644
--- a/compiler/coreSyn/CoreLint.hs
+++ b/compiler/coreSyn/CoreLint.hs
@@ -1646,7 +1646,11 @@ lintCoercion co@(UnivCo prov r ty1 ty2)
 
        -- see #9122 for discussion of these checks
      checkTypes t1 t2
-       = do { when (not (lev_poly1 || lev_poly2)) $
+       = do { checkWarnL (not lev_poly1)
+                         (report "left-hand type is levity-polymorphic")
+            ; checkWarnL (not lev_poly2)
+                         (report "right-hand type is levity-polymorphic")
+            ; when (not (lev_poly1 || lev_poly2)) $
               do { checkWarnL (reps1 `equalLength` reps2)
                               (report "between values with different # of reps")
                  ; zipWithM_ validateCoercion reps1 reps2 }}



More information about the ghc-commits mailing list