[GHC] #13834: Error cascade with type applications

GHC ghc-devs at haskell.org
Thu Jun 22 15:35:53 UTC 2017


#13834: Error cascade with type applications
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:  newcomer,
                                     |  TypeApplications
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Trac #13834

 Here is what is happening:

 * The `Cannot apply expression..." error is spat out immediately,
   during constraint generation, not by `TcErrors`

 * The `Variable not in scope..` error is deferred; we spit out a
   constraint (a `CHoleCan` in fact).  The constraint solver does its
   work; doing so will not solve the `CHoleCan`, but it often /does/
   figure out what type the out-of-scope variable should have.  The
   error is finally reported by `TcErrors`, when it reports errors from
   unsolved constraints

 Fixing this would be possible but fiddly.  The obvious thing would
 be to add a new form of constraint, or generalise `CHoleCan`, to
 allow the "Cannot apply" error to be deferred.

 Then the error-message-prioritisation scheme in `TcErrors` could
 give the out-of-scope error priority over the cannot-apply one.

 If we did this, it should probably be just part of a generic way of
 deferring error messages.  There are othe errors that are spat out
 immediately rather than going through the constraint solver.

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


More information about the ghc-tickets mailing list