[GHC] #8569: ASSERT in testcase type-rep, only in some ways:

GHC ghc-devs at haskell.org
Thu Mar 6 12:17:13 UTC 2014


#8569: ASSERT in testcase type-rep, only in some ways:
-------------------------------------+------------------------------------
        Reporter:  nomeata           |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Test Suite        |          Version:  7.7
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"4b355cd21a190e3d2c2d3a830ba2337d1c442dfe/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="4b355cd21a190e3d2c2d3a830ba2337d1c442dfe"
 Make the demand on a binder compatible with type (fixes Trac #8569)

 Because of GADTs and casts we were getting binders whose
 demand annotation was more deeply nested than made sense
 for its type.

 See Note [Trimming a demand to a type], in Demand.lhs,
 which I reproduce here:

    Note [Trimming a demand to a type]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Consider this:

      f :: a -> Bool
      f x = case ... of
              A g1 -> case (x |> g1) of (p,q) -> ...
              B    -> error "urk"

    where A,B are the constructors of a GADT.  We'll get a U(U,U) demand
    on x from the A branch, but that's a stupid demand for x itself, which
    has type 'a'. Indeed we get ASSERTs going off (notably in
    splitUseProdDmd, Trac #8569).

    Bottom line: we really don't want to have a binder whose demand is more
    deeply-nested than its type.  There are various ways to tackle this.
    When processing (x |> g1), we could "trim" the incoming demand U(U,U)
    to match x's type.  But I'm currently doing so just at the moment when
    we pin a demand on a binder, in DmdAnal.findBndrDmd.
 }}}

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


More information about the ghc-tickets mailing list