[commit: ghc] master: Make lazy unlifted bindings an error by default. (7f23a5d)

git at git.haskell.org git at git.haskell.org
Mon Sep 30 00:23:29 CEST 2013


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

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

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

commit 7f23a5dfd8ea061a25f13b1ecef799d834732668
Author: Austin Seipp <austin at well-typed.com>
Date:   Mon Sep 9 21:50:52 2013 -0500

    Make lazy unlifted bindings an error by default.
    
    This was supposed to happen a long time ago, but later is better than
    never. This makes `-fwarn-lazy-unlifted-bindings` into a no-op (with its
    own warning) to be removed in GHC 7.10.
    
    This fixes #8022.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


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

7f23a5dfd8ea061a25f13b1ecef799d834732668
 compiler/main/DynFlags.hs      |    4 ++--
 compiler/typecheck/TcBinds.lhs |   10 +++++-----
 docs/users_guide/flags.xml     |    2 +-
 docs/users_guide/using.xml     |    8 +-------
 4 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index d6b386a..40b8156 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2542,7 +2542,8 @@ fWarningFlags = [
   ( "warn-auto-orphans",                Opt_WarnAutoOrphans, nop ),
   ( "warn-tabs",                        Opt_WarnTabs, nop ),
   ( "warn-unrecognised-pragmas",        Opt_WarnUnrecognisedPragmas, nop ),
-  ( "warn-lazy-unlifted-bindings",      Opt_WarnLazyUnliftedBindings, nop ),
+  ( "warn-lazy-unlifted-bindings",      Opt_WarnLazyUnliftedBindings,
+    \_ -> deprecate "it has no effect, and will be removed in GHC 7.10" ),
   ( "warn-unused-do-bind",              Opt_WarnUnusedDoBind, nop ),
   ( "warn-wrong-do-bind",               Opt_WarnWrongDoBind, nop ),
   ( "warn-alternative-layout-rule-transitional", Opt_WarnAlternativeLayoutRuleTransitional, nop ),
@@ -2961,7 +2962,6 @@ standardWarnings
         Opt_WarnEmptyEnumerations,
         Opt_WarnMissingFields,
         Opt_WarnMissingMethods,
-        Opt_WarnLazyUnliftedBindings,
         Opt_WarnWrongDoBind,
         Opt_WarnUnsupportedCallingConventions,
         Opt_WarnDodgyForeignImports,
diff --git a/compiler/typecheck/TcBinds.lhs b/compiler/typecheck/TcBinds.lhs
index 532e6ef..fced8ae 100644
--- a/compiler/typecheck/TcBinds.lhs
+++ b/compiler/typecheck/TcBinds.lhs
@@ -1345,11 +1345,11 @@ checkStrictBinds top_lvl rec_group orig_binds tc_binds poly_ids
         ; checkTc (isSingleton orig_binds)
                   (strictBindErr "Multiple" unlifted orig_binds)
 
-        -- This should be a checkTc, not a warnTc, but as of GHC 6.11
-        -- the versions of alex and happy available have non-conforming
-        -- templates, so the GHC build fails if it's an error:
-        ; warnUnlifted <- woptM Opt_WarnLazyUnliftedBindings
-        ; warnTc (warnUnlifted && not bang_pat && lifted_pat)
+        -- Ensure that unlifted bindings which look lazy, like:
+        --   f x = let I# y = x
+        -- cause an error.
+        ; when lifted_pat $
+            checkTc bang_pat
                  -- No outer bang, but it's a compound pattern
                  -- E.g   (I# x#) = blah
                  -- Warn about this, but not about
diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml
index cc40dfc..557b1d5 100644
--- a/docs/users_guide/flags.xml
+++ b/docs/users_guide/flags.xml
@@ -1351,7 +1351,7 @@
 
           <row>
             <entry><option>-fwarn-lazy-unlifted-bindings</option></entry>
-            <entry>warn when a pattern binding looks lazy but must be strict</entry>
+            <entry><emphasis>(deprecated)</emphasis> warn when a pattern binding looks lazy but must be strict</entry>
             <entry>dynamic</entry>
             <entry><option>-fno-warn-lazy-unlifted-bindings</option></entry>
           </row>
diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml
index 8ac2779..5618a2a 100644
--- a/docs/users_guide/using.xml
+++ b/docs/users_guide/using.xml
@@ -976,7 +976,6 @@ test.hs:(5,4)-(6,7):
     <option>-fwarn-empty-enumerations</option>,
     <option>-fwarn-missing-fields</option>,
     <option>-fwarn-missing-methods</option>,
-    <option>-fwarn-lazy-unlifted-bindings</option>,
     <option>-fwarn-wrong-do-bind</option>,
     <option>-fwarn-unsupported-calling-conventions</option>,
     <option>-fwarn-dodgy-foreign-imports</option>,
@@ -1266,12 +1265,7 @@ foreign import "&amp;f" f :: FunPtr t
         <listitem>
           <indexterm><primary><option>-fwarn-lazy-unlifted-bindings</option></primary>
           </indexterm>
-          <para>Causes a warning to be emitted when an unlifted type
-      is bound in a way that looks lazy, e.g.
-      <literal>where (I# x) = ...</literal>. Use
-      <literal>where !(I# x) = ...</literal> instead. This will be an
-      error, rather than a warning, in GHC 7.2.
-      </para>
+          <para>This flag is a no-op, and will be removed in GHC 7.10.</para>
         </listitem>
       </varlistentry>
 




More information about the ghc-commits mailing list