[Git][ghc/ghc][master] Add regression tests for #16244, #16245, #16758

Marge Bot gitlab at gitlab.haskell.org
Tue May 5 07:25:04 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
2420c555 by Ryan Scott at 2020-05-05T03:24:53-04:00
Add regression tests for #16244, #16245, #16758

Commit e3c374cc5bd7eb49649b9f507f9f7740697e3f70 ended up
fixing quite a few bugs:

* This commit fixes #16244 completely. A regression test has been
  added.
* This commit fixes one program from #16245. (The program in
  https://gitlab.haskell.org/ghc/ghc/issues/16245#note_211369 still
  panics, and the program in
  https://gitlab.haskell.org/ghc/ghc/issues/16245#note_211400 still
  loops infinitely.) A regression test has been added for this
  program.
* This commit fixes #16758. Accordingly, this patch removes the
  `expect_broken` label from the `T16758` test case, moves it from
  `should_compile` to `should_fail` (as it should produce an error
  message), and checks in the expected stderr.

- - - - -


9 changed files:

- + testsuite/tests/polykinds/T16244.hs
- + testsuite/tests/polykinds/T16244.stderr
- + testsuite/tests/polykinds/T16245.hs
- + testsuite/tests/polykinds/T16245.stderr
- testsuite/tests/polykinds/all.T
- testsuite/tests/saks/should_compile/all.T
- testsuite/tests/saks/should_compile/T16758.hs → testsuite/tests/saks/should_fail/T16758.hs
- + testsuite/tests/saks/should_fail/T16758.stderr
- testsuite/tests/saks/should_fail/all.T


Changes:

=====================================
testsuite/tests/polykinds/T16244.hs
=====================================
@@ -0,0 +1,11 @@
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE PolyKinds #-}
+module T16244 where
+
+import Data.Kind
+
+type Const a b = a
+type SameKind (a :: k) (b :: k) = (() :: Constraint)
+class SameKind a b => C (k :: Const Type a) (b :: k)


=====================================
testsuite/tests/polykinds/T16244.stderr
=====================================
@@ -0,0 +1,11 @@
+
+T16244.hs:11:18: error:
+    • Couldn't match kind ‘k1’ with ‘k’
+      ‘k1’ is a rigid type variable bound by
+        the class declaration for ‘C’
+        at T16244.hs:11:26
+      ‘k’ is a rigid type variable bound by
+        the class declaration for ‘C’
+        at T16244.hs:11:1-52
+    • In the second argument of ‘SameKind’, namely ‘b’
+      In the class declaration for ‘C’


=====================================
testsuite/tests/polykinds/T16245.hs
=====================================
@@ -0,0 +1,11 @@
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE QuantifiedConstraints #-}
+module T16245 where
+
+import Data.Kind
+
+type Const a b = a
+type SameKind (a :: k) (b :: k) = (() :: Constraint)
+class (forall (b :: k). SameKind a b) => C (k :: Const Type a)


=====================================
testsuite/tests/polykinds/T16245.stderr
=====================================
@@ -0,0 +1,11 @@
+
+T16245.hs:11:36: error:
+    • Couldn't match kind ‘k1’ with ‘k’
+      ‘k1’ is a rigid type variable bound by
+        the class declaration for ‘C’
+        at T16245.hs:11:45
+      ‘k’ is a rigid type variable bound by
+        the class declaration for ‘C’
+        at T16245.hs:11:1-62
+    • In the second argument of ‘SameKind’, namely ‘b’
+      In the class declaration for ‘C’


=====================================
testsuite/tests/polykinds/all.T
=====================================
@@ -211,6 +211,8 @@ test('T16247a', normal, compile_fail, [''])
 test('KindVarOrder', normal, ghci_script, ['KindVarOrder.script'])
 test('T16221', normal, compile, [''])
 test('T16221a', normal, compile_fail, [''])
+test('T16244', normal, compile_fail, [''])
+test('T16245', normal, compile_fail, [''])
 test('T16342', normal, compile, [''])
 test('T16263', normal, compile_fail, [''])
 test('T16902', normal, compile_fail, [''])


=====================================
testsuite/tests/saks/should_compile/all.T
=====================================
@@ -34,7 +34,6 @@ test('T16723', normal, compile, [''])
 test('T16724', extra_files(['T16724.hs']), ghci_script, ['T16724.script'])
 test('T16726', normal, compile, [''])
 test('T16731', normal, compile, [''])
-test('T16758', expect_broken(16758), compile, [''])
 test('T16721', normal, ghci_script, ['T16721.script'])
 test('T16756a', normal, compile, [''])
 


=====================================
testsuite/tests/saks/should_compile/T16758.hs → testsuite/tests/saks/should_fail/T16758.hs
=====================================


=====================================
testsuite/tests/saks/should_fail/T16758.stderr
=====================================
@@ -0,0 +1,8 @@
+
+T16758.hs:14:8: error:
+    • Couldn't match expected kind ‘Int’ with actual kind ‘a’
+      ‘a’ is a rigid type variable bound by
+        the class declaration for ‘C’
+        at T16758.hs:12:19
+    • In the type signature: f :: C a => a -> Int
+      In the class declaration for ‘C’


=====================================
testsuite/tests/saks/should_fail/all.T
=====================================
@@ -30,3 +30,4 @@ test('T16727b', normal, compile_fail, [''])
 test('T16725', normal, compile_fail, [''])
 test('T16826', normal, compile_fail, [''])
 test('T16756b', normal, compile_fail, [''])
+test('T16758', normal, compile_fail, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2420c555e6cb681f4ef7c4ae3192a850ab431759

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2420c555e6cb681f4ef7c4ae3192a850ab431759
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/20200505/2334eec6/attachment-0001.html>


More information about the ghc-commits mailing list