diff --git a/compiler/GHC/Hs/Binds.hs b/compiler/GHC/Hs/Binds.hs index 47cd4cc1c7b746fce84732f75bcecc5c8fe643a6..6e21fef67f105908d972f8728a23b1f5efc704ad 100644 --- a/compiler/GHC/Hs/Binds.hs +++ b/compiler/GHC/Hs/Binds.hs @@ -898,8 +898,13 @@ extractSpecPragName srcTxt = case (words $ show srcTxt) of instance OutputableBndrId p => Outputable (FixitySig (GhcPass p)) where - ppr (FixitySig _ names fixity) = sep [ppr fixity, pprops] + ppr (FixitySig ns_spec names fixity) = sep [ppr fixity, ppr_ns_spec, pprops] where + ppr_ns_spec = + case ghcPass @p of + GhcPs -> ppr ns_spec + GhcRn -> ppr ns_spec + GhcTc -> empty pprops = hsep $ punctuate comma (map (pprInfixOcc . unLoc) names) pragBrackets :: SDoc -> SDoc diff --git a/testsuite/tests/rename/should_fail/T14032c.stderr b/testsuite/tests/rename/should_fail/T14032c.stderr index 37c8509b13f82105f4642bd5886b72e113969763..f64d3bd7ad3e9041b4ba9afc185195bf11a09192 100644 --- a/testsuite/tests/rename/should_fail/T14032c.stderr +++ b/testsuite/tests/rename/should_fail/T14032c.stderr @@ -1,14 +1,14 @@ - T14032c.hs:1:1: error: [GHC-78534] Illegal use of the ‘type’ keyword: - infix 0 $ + infix 0 type $ in a fixity signature Suggested fix: Perhaps you intended to use the ‘ExplicitNamespaces’ extension (implied by ‘TypeFamilies’ and ‘TypeOperators’) T14032c.hs:1:1: error: [GHC-78534] Illegal use of the ‘data’ keyword: - infix 0 $ + infix 0 data $ in a fixity signature Suggested fix: Perhaps you intended to use the ‘ExplicitNamespaces’ extension (implied by ‘TypeFamilies’ and ‘TypeOperators’) + diff --git a/testsuite/tests/th/T24911.hs b/testsuite/tests/th/T24911.hs new file mode 100644 index 0000000000000000000000000000000000000000..fa738eef53d03fc000a02521eaf438bcc8cfb757 --- /dev/null +++ b/testsuite/tests/th/T24911.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE ExplicitNamespaces #-} +{-# LANGUAGE TemplateHaskell #-} +module T24911 where + +$([d| infixl 4 data ### + (###) :: a -> a -> a + x ### y = x + + infixl 4 type ### + type (###) :: a -> a -> a + type x ### y = x + |]) diff --git a/testsuite/tests/th/T24911.stderr b/testsuite/tests/th/T24911.stderr new file mode 100644 index 0000000000000000000000000000000000000000..ff2e395914404d768202905babe466a53f7a6c1e --- /dev/null +++ b/testsuite/tests/th/T24911.stderr @@ -0,0 +1,17 @@ +T24911.hs:(5,2)-(12,7): Splicing declarations + [d| infixl 4 type ### + infixl 4 data ### + + (###) :: a -> a -> a + x ### y = x + + type (###) :: a -> a -> a + + type x ### y = x |] + ======> + infixl 4 data ### + (###) :: a -> a -> a + (###) x y = x + infixl 4 type ### + type (###) :: a -> a -> a + type (###) x y = x diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index bda61c4df471645f00026c3fcf5c433e2da1611b..0e2febdcb99f83c07871a848b4b96a3f30fd6254 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -615,3 +615,4 @@ test('T24557e', normal, compile, ['']) test('T24702a', normal, compile, ['']) test('T24702b', normal, compile, ['']) test('T24837', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) +test('T24911', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])