Make lazy unlifted bindings an error by default.
authorAustin Seipp <austin@well-typed.com>
Tue, 10 Sep 2013 02:50:52 +0000 (21:50 -0500)
committerAustin Seipp <austin@well-typed.com>
Sun, 29 Sep 2013 12:31:12 +0000 (07:31 -0500)
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@well-typed.com>
compiler/main/DynFlags.hs
compiler/typecheck/TcBinds.lhs
docs/users_guide/flags.xml
docs/users_guide/using.xml

index d6b386a..40b8156 100644 (file)
@@ -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,
index 532e6ef..fced8ae 100644 (file)
@@ -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
index cc40dfc..557b1d5 100644 (file)
 
           <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>
index 8ac2779..5618a2a 100644 (file)
@@ -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>