[commit: ghc] ghc-8.0: Add test for #12788 (b72b7c8)

git at git.haskell.org git at git.haskell.org
Thu Nov 10 21:42:50 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/b72b7c8a2e23196a7d5e1d72dbb8f1b790545cda/ghc

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

commit b72b7c8a2e23196a7d5e1d72dbb8f1b790545cda
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Thu Nov 3 14:01:54 2016 -0400

    Add test for #12788
    
    Commit bce99086e9f54909f51ff5a74cb8c666083bb021 (#12584) fixed #12788. Let's
    add a test to make sure it stays fixed.
    
    (cherry picked from commit ec22bacdd625b04d28228dd5522d59d0bc8b1152)


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

b72b7c8a2e23196a7d5e1d72dbb8f1b790545cda
 testsuite/tests/th/T12788.hs     |  9 +++++++++
 testsuite/tests/th/T12788.stderr |  2 ++
 testsuite/tests/th/T12788_Lib.hs | 22 ++++++++++++++++++++++
 testsuite/tests/th/all.T         |  3 +++
 4 files changed, 36 insertions(+)

diff --git a/testsuite/tests/th/T12788.hs b/testsuite/tests/th/T12788.hs
new file mode 100644
index 0000000..dc13c4f
--- /dev/null
+++ b/testsuite/tests/th/T12788.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE TemplateHaskell #-}
+module T12788 where
+
+import Language.Haskell.TH
+import T12788_Lib
+
+data Bad = Bad { _bad :: String } deriving (Eq, Ord, Show)
+
+$(deriveJSON defaultOptions{} ''Bad)
diff --git a/testsuite/tests/th/T12788.stderr b/testsuite/tests/th/T12788.stderr
new file mode 100644
index 0000000..485b200
--- /dev/null
+++ b/testsuite/tests/th/T12788.stderr
@@ -0,0 +1,2 @@
+
+T12788.hs:9:14: error: Empty record update
diff --git a/testsuite/tests/th/T12788_Lib.hs b/testsuite/tests/th/T12788_Lib.hs
new file mode 100644
index 0000000..2924eef
--- /dev/null
+++ b/testsuite/tests/th/T12788_Lib.hs
@@ -0,0 +1,22 @@
+module T12788_Lib where
+
+import Language.Haskell.TH
+
+data Options = Options
+    { fieldLabelModifier :: String -> String
+    , constructorTagModifier :: String -> String
+    , allNullaryToStringTag :: Bool
+    , omitNothingFields :: Bool
+    , sumEncoding :: SumEncoding
+    , unwrapUnaryRecords :: Bool
+    }
+
+data SumEncoding =
+    TaggedObject { tagFieldName      :: String
+                 , contentsFieldName :: String
+                 }
+  | ObjectWithSingleField
+  | TwoElemArray
+
+deriveJSON :: Options -> Name -> Q [Dec]
+deriveJSON _ _ = return []
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index a59a4e1..bee7e43 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -417,3 +417,6 @@ test('T12130', extra_clean(['T12130a.hi','T12130a.o']),
               multimod_compile, ['T12130', '-v0 ' + config.ghc_th_way_flags])
 test('T12407', omit_ways(['ghci']), compile, ['-v0'])
 test('T12411', normal, compile_fail, [''])
+test('T12788', extra_clean(['T12788_Lib.hi', 'T12788_Lib.o']),
+               multimod_compile_fail,
+               ['T12788.hs', '-v0 ' + config.ghc_th_way_flags])



More information about the ghc-commits mailing list