[GHC] #14363: :type hangs on coerce

GHC ghc-devs at haskell.org
Fri Oct 20 12:01:52 UTC 2017


#14363: :type hangs on coerce
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:  Roles
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 Simon Peyton Jones <simonpj@…>):

 In [changeset:"3acd6164fea6d4d5d87521a291455a18c9c9a8ee/ghc" 3acd616/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="3acd6164fea6d4d5d87521a291455a18c9c9a8ee"
 Improve kick-out in the constraint solver

 This patch was provoked by Trac #14363.  Turned out that we were
 kicking out too many constraints in TcSMonad.kickOutRewritable, and
 that mean that the work-list never became empty: infinite loop!

 That in turn made me look harder at the Main Theorem in
 Note [Extending the inert equalities].

 Main changes

 * Replace TcType.isTyVarExposed by TcType.isTyVarHead.  The
   over-agressive isTyVarExposed is what caused Trac #14363.
   See Note [K3: completeness of solving] in TcSMonad.

 * TcType.Make anyRewriteableTyVar role-aware.  In particular,
       a ~R ty
   cannot rewrite
       b ~R f a
   See Note [anyRewriteableTyVar must be role-aware].  That means
   it has to be given a role argument, which forces a little
   refactoring.

   I think this change is fixing a bug that hasn't yet been reported.
   The actual reported bug is handled by the previous bullet.  But
   this change is definitely the Right Thing

 The main changes are in TcSMonad.kick_out_rewritable, and in TcType
 (isTyVarExposed ---> isTyVarHead).

 I did a little unforced refactoring:

  * Use the cc_eq_rel field of a CTyEqCan when it is available, rather
    than recomputing it.

  * Define eqCanRewrite :: EqRel -> EqRel -> EqRel, and use it, instead
    of duplicating its logic
 }}}

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


More information about the ghc-tickets mailing list