[commit: ghc] master: testsuite: Add tests for #15270 (18b74cd)

git at git.haskell.org git at git.haskell.org
Tue Dec 11 23:22:17 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/18b74cdbbfa053704caabd104587d8a91a9233a0/ghc

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

commit 18b74cdbbfa053704caabd104587d8a91a9233a0
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Dec 11 13:48:08 2018 -0500

    testsuite: Add tests for #15270
    
    Reviewers: alpmestan
    
    Reviewed By: alpmestan
    
    Subscribers: rwbarton, carter
    
    Differential Revision: https://phabricator.haskell.org/D5216


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

18b74cdbbfa053704caabd104587d8a91a9233a0
 testsuite/tests/th/T15270A.hs     | 8 ++++++++
 testsuite/tests/th/T15270A.stderr | 5 +++++
 testsuite/tests/th/T15270B.hs     | 8 ++++++++
 testsuite/tests/th/T15270B.stderr | 5 +++++
 testsuite/tests/th/all.T          | 2 ++
 5 files changed, 28 insertions(+)

diff --git a/testsuite/tests/th/T15270A.hs b/testsuite/tests/th/T15270A.hs
new file mode 100644
index 0000000..d317f8f
--- /dev/null
+++ b/testsuite/tests/th/T15270A.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module T10047A where
+
+import Language.Haskell.TH
+
+-- Passing var name to conE should fail.
+x = $(conE 'id)
diff --git a/testsuite/tests/th/T15270A.stderr b/testsuite/tests/th/T15270A.stderr
new file mode 100644
index 0000000..2eb67f6
--- /dev/null
+++ b/testsuite/tests/th/T15270A.stderr
@@ -0,0 +1,5 @@
+
+T15270A.hs:8:7:
+     Illegal data constructor name: ‘id’
+      When splicing a TH expression: GHC.Base.id
+     In the untyped splice: $(conE 'id)
diff --git a/testsuite/tests/th/T15270B.hs b/testsuite/tests/th/T15270B.hs
new file mode 100644
index 0000000..397b5dc
--- /dev/null
+++ b/testsuite/tests/th/T15270B.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module T10047B where
+
+import Language.Haskell.TH
+
+-- Passing datacon name to varE should fail.
+x = $(varE 'Just)
diff --git a/testsuite/tests/th/T15270B.stderr b/testsuite/tests/th/T15270B.stderr
new file mode 100644
index 0000000..3403d13
--- /dev/null
+++ b/testsuite/tests/th/T15270B.stderr
@@ -0,0 +1,5 @@
+
+T15270B.hs:8:7:
+     Illegal variable name: ‘Just’
+      When splicing a TH expression: GHC.Maybe.Just
+     In the untyped splice: $(varE 'Just)
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index e404c8f..0ab7dba 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -419,6 +419,8 @@ test('T14885a', normal, compile, [''])
 test('T14885b', normal, compile, [''])
 test('T14885c', normal, compile, [''])
 test('T15243', normal, compile, ['-dsuppress-uniques'])
+test('T15270A', normal, compile_fail, [''])
+test('T15270B', normal, compile_fail, [''])
 test('T15321', normal, compile_fail, [''])
 test('T15324', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
 test('T15331', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])



More information about the ghc-commits mailing list