Add regression test for Trac #13659
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 8 May 2017 13:06:01 +0000 (14:06 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 9 May 2017 09:43:57 +0000 (10:43 +0100)
testsuite/tests/polykinds/T13659.hs [new file with mode: 0644]
testsuite/tests/polykinds/T13659.stderr [new file with mode: 0644]
testsuite/tests/polykinds/all.T

diff --git a/testsuite/tests/polykinds/T13659.hs b/testsuite/tests/polykinds/T13659.hs
new file mode 100644 (file)
index 0000000..199ff08
--- /dev/null
@@ -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 (file)
index 0000000..fac5cbb
--- /dev/null
@@ -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’
index b59cbe6..28d33c1 100644 (file)
@@ -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, [''])