[GHC] #12126: Bad error messages for SPECIALIZE pragmas

GHC ghc-devs at haskell.org
Sat May 28 10:37:32 UTC 2016


#12126: Bad error messages for SPECIALIZE pragmas
-------------------------------------+-------------------------------------
        Reporter:  antalsz           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:  Specialize,
                                     |  ErrorMessages, newcomer
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 Thanks, this is a good bug report and something good for a newcomer to get
 started with. I think that fixing at least (2) and (3) should be easy.

 Here are my investigations so far:

 1. Specialisation signatures are handled in `TcBinds.tcSpecPrags`.
 2. `unifyType` fails to solve `Bool ~ (Num a => a -> a)` so it gets
 deferred to later on in the constraint solving process. At which point
 it is defaulted for some reason.

 1. The outer error context is added in `tcSpecPrag`.
 2. The inner error context is added as a result of `hsSigDoc`.

 Suggestion: Modify the outer context added in `tcSpecPrag`.

 1. The actual text that a user used can be found in the `inl_src` field of
 the `InlinePragma` field of `SpecSig`.

 Suggestion: There should be a few places to change where you can use this
 value rather than hard-coding `SPECIALISE`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12126#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list