[commit: ghc] master: Print the correct name when complaining about SPECIALISE pragmas (7db2340)

git at git.haskell.org git at git.haskell.org
Fri Nov 22 15:50:31 UTC 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7db23406e4162f9925474fc76b7dffd5d302c312/ghc

>---------------------------------------------------------------

commit 7db23406e4162f9925474fc76b7dffd5d302c312
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Nov 22 15:30:30 2013 +0000

    Print the correct name when complaining about SPECIALISE pragmas
    
    Fixes Trac #8537


>---------------------------------------------------------------

7db23406e4162f9925474fc76b7dffd5d302c312
 compiler/typecheck/TcBinds.lhs |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/compiler/typecheck/TcBinds.lhs b/compiler/typecheck/TcBinds.lhs
index 304d55b..f23527b 100644
--- a/compiler/typecheck/TcBinds.lhs
+++ b/compiler/typecheck/TcBinds.lhs
@@ -701,15 +701,17 @@ tcSpecPrags poly_id prag_sigs
 
 --------------
 tcSpec :: TcId -> Sig Name -> TcM TcSpecPrag
-tcSpec poly_id prag@(SpecSig _ hs_ty inl) 
-  -- The Name in the SpecSig may not be the same as that of the poly_id
+tcSpec poly_id prag@(SpecSig fun_name hs_ty inl) 
+  -- The Name fun_name in the SpecSig may not be the same as that of the poly_id
   -- Example: SPECIALISE for a class method: the Name in the SpecSig is
   --          for the selector Id, but the poly_id is something like $cop
+  -- However we want to use fun_name in the error message, since that is
+  -- what the user wrote (Trac #8537)
   = addErrCtxt (spec_ctxt prag) $
     do  { spec_ty <- tcHsSigType sig_ctxt hs_ty
         ; warnIf (not (isOverloadedTy poly_ty || isInlinePragma inl))
                  (ptext (sLit "SPECIALISE pragma for non-overloaded function") 
-                  <+> quotes (ppr poly_id))
+                  <+> quotes (ppr fun_name))
                   -- Note [SPECIALISE pragmas]
         ; wrap <- tcSubType origin sig_ctxt (idType poly_id) spec_ty
         ; return (SpecPrag poly_id wrap inl) }



More information about the ghc-commits mailing list