Authored by goldfire on Mar 22 2017, 9:32 PM.

Description

Fix Trac #13458

Core Lint shouldn't check representations of types that don't
have representations.

test case: typecheck/should_compile/T13458

nomeata raised a concern with this commit.Mar 29 2017, 10:37 PM
nomeata added a subscriber: nomeata.

This commit makes the build on perf.haskell.org produce huge build logs (>130MB) because of a spew of new lint warnings:

+*** Core Lint warnings : in result of Occurrence analysis ***
+<no location info>: warning:
+    In the expression: local_id
+                         @ b_aV
+                         (x_as
+                          `cast` (UnsafeCo representational a_aU b_aV
+                                  :: (a_aU :: *) ~R# (b_aV :: *)))
+    Unsafe coercion: left-hand type is levity-polymorphic
+      From: a_aU
+        To: b_aV
+
+<no location info>: warning:
+    In the expression: local_id
+                         @ b_aV
+                         (x_as
+                          `cast` (UnsafeCo representational a_aU b_aV
+                                  :: (a_aU :: *) ~R# (b_aV :: *)))
+    Unsafe coercion: right-hand type is levity-polymorphic
+      From: a_aU
+        To: b_aV
+
+*** Core Lint warnings : in result of Occurrence analysis ***
+libraries/base/Unsafe/Coerce.hs:58:1: warning:
+    [RHS of unsafeCoerce :: forall a b. a -> b]
+    Unsafe coercion: left-hand type is levity-polymorphic
+      From: a_aU
+        To: b_aV
+
+libraries/base/Unsafe/Coerce.hs:58:1: warning:
+    [RHS of unsafeCoerce :: forall a b. a -> b]
+    Unsafe coercion: right-hand type is levity-polymorphic
+      From: a_aU
+        To: b_aV
+

or

+<no location info>: warning:
+    In the expression: (ipv1_XUpe
+                        `cast` (N:HValue[0]
+                                ; UnsafeCo representational Any ([String] -> Int -> IO String)
+                                :: (HValue :: *) ~R# (([String] -> Int -> IO String) :: *)))
+                         mods_aol0 line_aol1
+    Unsafe coercion: left-hand type is levity-polymorphic
+      From: Any
+        To: [String] -> Int -> IO String
+
+<no location info>: warning:
+    In the expression: (ipv1_XUpe
+                        `cast` (N:HValue[0]
+                                ; UnsafeCo representational Any ([String] -> Int -> IO String)
+                                :: (HValue :: *) ~R# (([String] -> Int -> IO String) :: *)))
+                         mods_aol0 line_aol1
+    Unsafe coercion: right-hand type is levity-polymorphic
+      From: Any
+        To: [String] -> Int -> IO String
+

Because Github (rightfully) reject such large files, this currently leaves perf.haskell.org broken. And given the large number of occurrences, this does not seem to be a useful warning right now.

This commit now has outstanding concerns.Mar 29 2017, 10:37 PM

Not only is it not useful, but the warning is utterly wrong. Ben said he was looking into this.

Is there a reason not to quickly and simply disable the warning until this has been looked into?

Ok, I just did that in 03c7dd0941fb4974be54026ef3e4bb97451c3b1f. It can be reverted if that was uncalled for, but ideally with a patch that avoids spamming the log.

nomeata resigned from this commit.Mar 31 2017, 8:59 AM
This commit no longer requires audit.Mar 31 2017, 8:59 AM