[GHC] #11525: Using a dummy typechecker plugin causes an ambiguity check error

GHC ghc-devs at haskell.org
Fri Jan 27 11:28:18 UTC 2017


#11525: Using a dummy typechecker plugin causes an ambiguity check error
-------------------------------------+-------------------------------------
        Reporter:  jme               |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc1
  checker)                           |             Keywords:
      Resolution:                    |  UndecidableSuperClasses, plugin
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by adamgundry):

 * cc: adamgundry, simonpj (added)
 * keywords:   => UndecidableSuperClasses, plugin


Comment:

 Thanks for pointing me to this bug. The problem would appear to be the
 `UndecidableSuperClasses` changes in
 6eabb6ddb7c53784792ee26b1e0657bde7eee7fb, which introduced a new
 `expandSuperClasses` step after the `solveSimpleWanteds` loop. This is the
 step that looks for `CDictCan`, and hence fails to expand the constraint
 because the plugin-induced zonking has turned it into a `CNonCanonical`
 instead.

 I think the right way to fix this is to change `zonkCt` so that it
 preserves `CDictCan`, much as it already preserves `CHoleCan`. We want to
 zonk before running the plugins, as otherwise the plugins will have to
 expand mutable type variables themselves. I suspect that we shouldn't
 modify `expandSuperClasses` to look for `CNonCanoical` dictionaries,
 because it passes around information in the `cc_pend_sc` field of
 `CDictCan`.

 The code has changed quite a bit since I last looked at it, however, so it
 might be worth checking with someone more knowledgeable than me (simonpj?)
 if this makes sense.

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


More information about the ghc-tickets mailing list