[Git][ghc/ghc][wip/T18389] Accept even more stderr changes, improve UnliftedNewtypes-related suggestion

Ryan Scott gitlab at gitlab.haskell.org
Sat Oct 24 12:19:32 UTC 2020



Ryan Scott pushed to branch wip/T18389 at Glasgow Haskell Compiler / GHC


Commits:
44939c67 by Ryan Scott at 2020-10-24T08:18:29-04:00
Accept even more stderr changes, improve UnliftedNewtypes-related suggestion

- - - - -


6 changed files:

- compiler/GHC/Tc/TyCl.hs
- testsuite/tests/typecheck/should_fail/T12729.stderr
- testsuite/tests/typecheck/should_fail/T15807.stderr
- testsuite/tests/typecheck/should_fail/T15883.stderr
- testsuite/tests/typecheck/should_fail/UnliftedNewtypesNotEnabled.stderr
- testsuite/tests/typecheck/should_fail/tcfail079.stderr


Changes:

=====================================
compiler/GHC/Tc/TyCl.hs
=====================================
@@ -4180,7 +4180,7 @@ checkNewDataCon con
         ; let allowedArgType =
                 unlifted_newtypes || isLiftedType_maybe (scaledThing arg_ty1) == Just True
         ; checkTc allowedArgType $ vcat
-          [ text "A newtype cannot have an unlifted argument type"
+          [ text "A newtype must have an argument of kind" <+> ppr liftedTypeKind
           , text "Perhaps you intended to use UnliftedNewtypes"
           ]
         ; show_linear_types <- xopt LangExt.LinearTypes <$> getDynFlags


=====================================
testsuite/tests/typecheck/should_fail/T12729.stderr
=====================================
@@ -1,12 +1,12 @@
 
 T12729.hs:8:4: error:
-    • A newtype cannot have an unlifted argument type
+    • A newtype must have an argument of kind *
       Perhaps you intended to use UnliftedNewtypes
     • In the definition of data constructor ‘MkA’
       In the newtype declaration for ‘A’
 
 T12729.hs:10:13: error:
-    • A newtype cannot have an unlifted argument type
+    • A newtype must have an argument of kind *
       Perhaps you intended to use UnliftedNewtypes
     • In the definition of data constructor ‘MkB’
       In the newtype declaration for ‘B’


=====================================
testsuite/tests/typecheck/should_fail/T15807.stderr
=====================================
@@ -1,8 +1,10 @@
 
 T15807.hs:12:3: error:
-    • Cannot generalise type; skolem ‘f’ would escape its scope
+    • Cannot generalise type; skolem
+      ‘(f :: k0 -> *)’
+      would escape its scope
       if I tried to quantify (f0 :: f -> *) in this type:
-        forall f (a :: f). f a %1 -> App @f @f0 a
+        forall (f :: k0 -> *) (a :: k0). f a %1 -> App @f @f0 a
       (Indeed, I sometimes struggle even printing this correctly,
        due to its ill-scoped nature.)
     • In the definition of data constructor ‘MkApp’


=====================================
testsuite/tests/typecheck/should_fail/T15883.stderr
=====================================
@@ -1,5 +1,6 @@
 
-T15883.hs:9:1: error:
-    • Newtype has non-* return kind ‘TYPE rep’
+T15883.hs:9:19: error:
+    • A newtype must have an argument of kind *
       Perhaps you intended to use UnliftedNewtypes
-    • In the newtype declaration for ‘Foo’
+    • In the definition of data constructor ‘MkFoo’
+      In the newtype declaration for ‘Foo’


=====================================
testsuite/tests/typecheck/should_fail/UnliftedNewtypesNotEnabled.stderr
=====================================
@@ -1,6 +1,6 @@
 
 UnliftedNewtypesNotEnabled.hs:9:15: error:
-    • A newtype cannot have an unlifted argument type
+    • A newtype must have an argument of kind *
       Perhaps you intended to use UnliftedNewtypes
     • In the definition of data constructor ‘Baz’
       In the newtype declaration for ‘Baz’


=====================================
testsuite/tests/typecheck/should_fail/tcfail079.stderr
=====================================
@@ -1,5 +1,6 @@
 
-tcfail079.hs:9:1: error:
-    • Newtype has non-* return kind ‘TYPE 'GHC.Types.IntRep’
+tcfail079.hs:9:19: error:
+    • A newtype must have an argument of kind *
       Perhaps you intended to use UnliftedNewtypes
-    • In the newtype declaration for ‘Unboxed’
+    • In the definition of data constructor ‘Unboxed’
+      In the newtype declaration for ‘Unboxed’



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44939c67cb93b75296ffe4c788239d07589b5a29

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44939c67cb93b75296ffe4c788239d07589b5a29
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/20201024/30236e86/attachment-0001.html>


More information about the ghc-commits mailing list