#7645 closed bug (fixed)

Parens in an error message

Reported by: monoidal Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: typecheck/should_fail/T7645 Blocked By:
Blocking: Related Tickets: #7609

Description

{-# LANGUAGE TypeOperators #-}
data (+) a b
f :: ((+) a a, Maybe)
f = undefined

gives

X.hs:3:16:
    Expecting one more argument to `Maybe'
    In the type signature for `f': f :: (+ a a, Maybe)

which should be (+) a a. I tried

  • compiler/hsSyn/HsTypes.lhs

    diff --git a/compiler/hsSyn/HsTypes.lhs b/compiler/hsSyn/HsTypes.lhs
    index 74aa477..d0d9e1a 100644
    a b ppr_mono_ty ctxt_prec (HsForAllTy exp tvs ctxt ty) 
    614614ppr_mono_ty _    (HsBangTy b ty)     = ppr b <> ppr_mono_lty pREC_CON ty 
    615615ppr_mono_ty _    (HsQuasiQuoteTy qq) = ppr qq 
    616616ppr_mono_ty _    (HsRecTy flds)      = pprConDeclFields flds 
    617 ppr_mono_ty _    (HsTyVar name)      = ppr name 
     617ppr_mono_ty _    (HsTyVar name)      = pprPrefixOcc name 
    618618ppr_mono_ty prec (HsFunTy ty1 ty2)   = ppr_fun_ty prec ty1 ty2 
    619619ppr_mono_ty _    (HsTupleTy con tys) = tupleParens std_con (interpp'SP tys) 
    620620  where std_con = case con of 

but this causes the kind * to be printed as (*).

Change History (2)

comment:1 Changed 14 months ago by simonpj@…

commit 599aaf4e4dbb94a484eed5f624404194c6ca1fb9

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Thu Feb 14 14:37:43 2013 +0000

    Better pretty-printing for HsType, fixes Trac #7645

 compiler/basicTypes/Name.lhs        |   24 ++++++++++++++++++++++--
 compiler/basicTypes/RdrName.lhs     |    6 +++++-
 compiler/hsSyn/HsTypes.lhs          |    2 +-
 compiler/prelude/PrelNames.lhs-boot |    3 ++-
 4 files changed, 30 insertions(+), 5 deletions(-)

comment:2 Changed 14 months ago by simonpj

  • Difficulty set to Unknown
  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to typecheck/should_fail/T7645

Thanks! Fixed.

Note: See TracTickets for help on using tickets.