Commit 38c28c1a authored by Richard Eisenberg's avatar Richard Eisenberg

Fix #15761 by adding parens

This was just a pretty-printer infelicity. Fixed now.

Test case: printer/T15761
parent 2e1df7c1
......@@ -1764,13 +1764,15 @@ pprFamInstLHS thing typats fixity context mb_kind_sig
-- explicit type patterns
= hsep [ pprHsContext context, pp_pats typats, pp_kind_sig ]
where
pp_pats (patl:patsr)
| fixity == Infix
= hsep [pprHsType (unLoc patl), pprInfixOcc (unLoc thing)
, hsep (map (pprHsType.unLoc) patsr)]
| otherwise = hsep [ pprPrefixOcc (unLoc thing)
, hsep (map (pprHsType.unLoc) (patl:patsr))]
pp_pats [] = pprPrefixOcc (unLoc thing)
pp_pats (patl:patr:pats)
| Infix <- fixity
= let pp_op_app = hsep [ ppr patl, pprInfixOcc (unLoc thing), ppr patr ] in
case pats of
[] -> pp_op_app
_ -> hsep (parens pp_op_app : map ppr pats)
pp_pats pats = hsep [ pprPrefixOcc (unLoc thing)
, hsep (map ppr pats)]
pp_kind_sig
| Just k <- mb_kind_sig
......
{-# LANGUAGE TypeFamilies, TypeOperators #-}
data family (a + b) c d
data instance (Int + Bool) Double = Float
T15761.hs:5:1: error:
• Expecting one more argument to ‘(Int + Bool) Double’
Expected a type, but ‘(Int + Bool) Double’ has kind ‘* -> *’
• In the data instance declaration for ‘+’
......@@ -56,3 +56,4 @@ test('T14289c', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T142
test('T14306', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T14306'])
test('T14343', normal, compile_fail, [''])
test('T14343b', normal, compile_fail, [''])
test('T15761', normal, compile_fail, [''])
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