Commit 3aa09cc5 authored by Krzysztof Gogolewski's avatar Krzysztof Gogolewski

Fix pretty-printing of data declarations in splices

Test Plan: validate

Reviewers: RyanGlScott, bgamari

Reviewed By: RyanGlScott

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15365

Differential Revision: https://phabricator.haskell.org/D4998
parent f629442b
......@@ -757,7 +757,7 @@ pp_vanilla_decl_head thing (HsQTvs { hsq_explicit = tyvars }) fixity context
, hsep (map (ppr.unLoc) varsr)]
| otherwise = hsep [ pprPrefixOcc (unLoc thing)
, hsep (map (ppr.unLoc) (varl:varsr))]
pp_tyvars [] = ppr thing
pp_tyvars [] = pprPrefixOcc (unLoc thing)
pp_vanilla_decl_head _ (XLHsQTyVars x) _ _ = ppr x
pprTyClDeclFlavour :: TyClDecl (GhcPass p) -> SDoc
......@@ -2375,7 +2375,7 @@ type instance XXRoleAnnotDecl (GhcPass _) = NoExt
instance (p ~ GhcPass pass, OutputableBndr (IdP p))
=> Outputable (RoleAnnotDecl p) where
ppr (RoleAnnotDecl _ ltycon roles)
= text "type role" <+> ppr ltycon <+>
= text "type role" <+> pprPrefixOcc (unLoc ltycon) <+>
hsep (map (pp_role . unLoc) roles)
where
pp_role Nothing = underscore
......
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module T15365 where
$([d| type (|||) = Either
(&&&) :: Bool -> Bool -> Bool
(&&&) = (&&)
type role (***)
data (***)
class (???)
instance (???)
data family ($$$)
data instance ($$$)
type family (^^^)
type instance (^^^) = Int
type family (###) where
(###) = Int
pattern (:!!!) :: Bool
pattern (:!!!) = True
|])
T15365.hs:(9,3)-(31,6): Splicing declarations
[d| (&&&) :: Bool -> Bool -> Bool
(&&&) = (&&)
pattern (:!!!) :: Bool
pattern (:!!!) = True
type (|||) = Either
data (***)
class (???)
data family ($$$)
type family (^^^)
type family (###) where
(###) = Int
instance (???)
data instance ($$$)
type instance (^^^) = Int |]
======>
type (|||) = Either
(&&&) :: Bool -> Bool -> Bool
(&&&) = (&&)
type role (***)
data (***)
class (???)
instance (???)
data family ($$$)
data instance ($$$)
type family (^^^)
type instance (^^^) = Int
type family (###) where
(###) = Int
pattern (:!!!) :: Bool
pattern (:!!!) = True
......@@ -418,6 +418,7 @@ test('T15243', normal, compile, ['-dsuppress-uniques'])
test('T15321', normal, compile_fail, [''])
test('T15324', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
test('T15331', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
test('T15365', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
# Note: T9693 should be only_ways(['ghci']) once it's fixed.
test('T9693', expect_broken(9693), ghci_script, ['T9693.script'])
test('T14471', normal, compile, [''])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment