summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2019-06-01 15:08:24 +0300
committerBen Gamari <ben@well-typed.com>2019-06-08 13:45:07 -0400
commit88b2ef1e299f26d30901df5ecbb23fd49f2513ba (patch)
treebcc0084036f982f1ec669ad4cb8095b44af7a111
parent709290b01c3c63137d863d6fdd97dabdfe47eb29 (diff)
downloadhaskell-wip/16718.tar.gz
Print role annotations in TemplateHaskell brackets (#16718)wip/16718
-rw-r--r--compiler/hsSyn/HsDecls.hs1
-rw-r--r--testsuite/tests/roles/should_compile/T16718.hs7
-rw-r--r--testsuite/tests/roles/should_compile/T16718.stderr7
-rw-r--r--testsuite/tests/roles/should_compile/all.T1
-rw-r--r--testsuite/tests/th/T15365.stderr2
5 files changed, 18 insertions, 0 deletions
diff --git a/compiler/hsSyn/HsDecls.hs b/compiler/hsSyn/HsDecls.hs
index 388c770720..053f31eb2f 100644
--- a/compiler/hsSyn/HsDecls.hs
+++ b/compiler/hsSyn/HsDecls.hs
@@ -302,6 +302,7 @@ instance (p ~ GhcPass pass, OutputableBndrId p) => Outputable (HsGroup p) where
if isEmptyValBinds val_decls
then Nothing
else Just (ppr val_decls),
+ ppr_ds (tyClGroupRoleDecls tycl_decls),
ppr_ds (tyClGroupTyClDecls tycl_decls),
ppr_ds (tyClGroupInstDecls tycl_decls),
ppr_ds deriv_decls,
diff --git a/testsuite/tests/roles/should_compile/T16718.hs b/testsuite/tests/roles/should_compile/T16718.hs
new file mode 100644
index 0000000000..bae1d70f43
--- /dev/null
+++ b/testsuite/tests/roles/should_compile/T16718.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE RoleAnnotations, TemplateHaskell #-}
+
+module T16718 where
+
+$([d| type role P phantom
+ data P a
+ |])
diff --git a/testsuite/tests/roles/should_compile/T16718.stderr b/testsuite/tests/roles/should_compile/T16718.stderr
new file mode 100644
index 0000000000..8e2530ef31
--- /dev/null
+++ b/testsuite/tests/roles/should_compile/T16718.stderr
@@ -0,0 +1,7 @@
+T16718.hs:(5,3)-(7,6): Splicing declarations
+ [d| type role P phantom
+
+ data P a |]
+ ======>
+ type role P phantom
+ data P a
diff --git a/testsuite/tests/roles/should_compile/all.T b/testsuite/tests/roles/should_compile/all.T
index 28f344fa86..ae4a490579 100644
--- a/testsuite/tests/roles/should_compile/all.T
+++ b/testsuite/tests/roles/should_compile/all.T
@@ -10,3 +10,4 @@ test('T8958', [normalise_fun(normalise_errmsg), only_ways('normal')], compile, [
test('T10263', normal, compile, [''])
test('T9204b', [], multimod_compile, ['T9204b', '-v0'])
test('T14101', normal, compile, [''])
+test('T16718', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
diff --git a/testsuite/tests/th/T15365.stderr b/testsuite/tests/th/T15365.stderr
index 3c85950831..9631319eab 100644
--- a/testsuite/tests/th/T15365.stderr
+++ b/testsuite/tests/th/T15365.stderr
@@ -4,6 +4,8 @@ T15365.hs:(9,3)-(31,6): Splicing declarations
pattern (:!!!) :: Bool
pattern (:!!!) = True
+ type role (***)
+
type (|||) = Either
data (***)
class (???)