[GHC] #9739: GHC 7.8 chokes on recursive classes

GHC ghc-devs at haskell.org
Fri Oct 31 12:26:41 UTC 2014


#9739: GHC 7.8 chokes on recursive classes
-------------------------------------+-------------------------------------
              Reporter:  bitonic     |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:  7.10.1
             Component:  Compiler    |          Version:  7.9
  (Type checker)                     |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:  Compile-    |  Related Tickets:
  time crash                         |
             Test Case:              |
  typecheck/should_fail/T9739        |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * testcase:   => typecheck/should_fail/T9739


Comment:

 The 3-class version still loops in HEAD. Reason is this:
  * `TcTyClsDcls.checkValidClass` is called on each class in turn.
  * It checks for superclass cycles, and then checks for ambiguity of the
 method types
  * The ambiguity check loops if there is a superclass cycle
  * The superclass cycle check was first, and aborted `checkValidClass` if
 it failed.
  * BUT we failed to notice that it would loop if there was a superclass
 cycle in ''another'' class in the group; and after each class we dust
 ourselves off and the next one, to get as many validity errors as
 possible.

 Solution was simple: make the ambiguity check happen only if there have
 been no errors so far.

 Patch coming

 Simon

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


More information about the ghc-tickets mailing list