Commit 9a939a6c authored by Ryan Scott's avatar Ryan Scott Committed by Marge Bot

Print name prefixly in the Outputable instance for StandaloneKindSig

Issue #17461 was occurring because the `Outputable` instance for
standalone kind signatures was simply calling `ppr` on the name in
the kind signature, which does not add parentheses to infix names.
The solution is simple: use `pprPrefixOcc` instead.

Fixes #17461.
parent b4b19d89
......@@ -1471,7 +1471,8 @@ instance OutputableBndrId p
instance OutputableBndrId p
=> Outputable (StandaloneKindSig (GhcPass p)) where
ppr (StandaloneKindSig _ v ki) = text "type" <+> ppr v <+> text "::" <+> ppr ki
ppr (StandaloneKindSig _ v ki)
= text "type" <+> pprPrefixOcc (unLoc v) <+> text "::" <+> ppr ki
ppr (XStandaloneKindSig nec) = noExtCon nec
instance Outputable NewOrData where
......
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
module T17461 where
import Data.Kind
$([d| type (:+:) :: Type -> Type -> Type
type (:+:) = Either
|])
T17461.hs:(8,3)-(10,6): Splicing declarations
[d| type (:+:) :: Type -> Type -> Type
type (:+:) = Either |]
======>
type (:+:) :: Type -> Type -> Type
type (:+:) = Either
......@@ -491,3 +491,4 @@ test('T17380', normal, compile_fail, [''])
test('T17394', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
test('T17379a', normal, compile_fail, [''])
test('T17379b', normal, compile_fail, [''])
test('T17461', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
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