[commit: ghc] master: Add regression test for Trac #13659 (6f26fe7)

git at git.haskell.org git at git.haskell.org
Tue May 9 09:44:31 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6f26fe79c1952df7881f17cb504c4ecae527def7/ghc

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

commit 6f26fe79c1952df7881f17cb504c4ecae527def7
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon May 8 14:06:01 2017 +0100

    Add regression test for Trac #13659


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

6f26fe79c1952df7881f17cb504c4ecae527def7
 testsuite/tests/polykinds/T13659.hs     | 12 ++++++++++++
 testsuite/tests/polykinds/T13659.stderr |  6 ++++++
 testsuite/tests/polykinds/all.T         |  1 +
 3 files changed, 19 insertions(+)

diff --git a/testsuite/tests/polykinds/T13659.hs b/testsuite/tests/polykinds/T13659.hs
new file mode 100644
index 0000000..199ff08
--- /dev/null
+++ b/testsuite/tests/polykinds/T13659.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE GADTs, EmptyDataDecls, TypeFamilies, TypeOperators, DataKinds, FlexibleInstances #-}
+
+{- Defines a C-like printf function using DataKinds extensions. -}
+
+module T13659 where
+
+-- format string parameterized by a list of types
+data Format (fmt :: [*]) where
+  X :: Format '[]                   -- empty string, i.e. ""
+  L :: a -> String -> Format '[]    -- string literal, e.g. "hello"
+  S :: a -> Format '[String]        -- "%s"
+  I :: Format a -> Format '[Int, a] -- "%d"
diff --git a/testsuite/tests/polykinds/T13659.stderr b/testsuite/tests/polykinds/T13659.stderr
new file mode 100644
index 0000000..fac5cbb
--- /dev/null
+++ b/testsuite/tests/polykinds/T13659.stderr
@@ -0,0 +1,6 @@
+
+T13659.hs:12:27: error:
+    • Expected a type, but ‘a’ has kind ‘[*]’
+    • In the first argument of ‘Format’, namely ‘'[Int, a]’
+      In the type ‘Format '[Int, a]’
+      In the definition of data constructor ‘I’
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index b59cbe6..28d33c1 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -161,3 +161,4 @@ test('T13394', normal, compile, [''])
 test('T13371', normal, compile, [''])
 test('T13393', normal, compile_fail, [''])
 test('T13555', normal, compile_fail, [''])
+test('T13659', normal, compile_fail, [''])



More information about the ghc-commits mailing list