Opened 6 years ago

Closed 6 years ago

#2882 closed bug (invalid)

variable escaping in existential type error on 6.8 but not 6.10

Reported by: ckeen Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: x86
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

I wrote a patch for darcs that does the following:

'l' -> do let selected = case get_choices pc of
                                          (first_chs:>_:>last_chs) ->
                                             if whichch == Last || whichch == FirstReversed
                                                then last_chs else first_chs
                      putStrLn $ "---- Already selected "++things++" ----"
                      mapM_ putDocLn $ mapFL (\a ->
                        showPatch `unseal2` (seal2 $ tp_patch a)) selected

where

get_choices :: Patchy p => PatchChoices p C(x y) -> (FL (TaggedPatch p) :> FL (TaggedPatch p) :> FL (TaggedPatch p)) C(x y)
data (a1 :> a2) C(x y) = FORALL(z) (a1 C(x z)) :> (a2 C(z y))
data FL a C(x z) where
    (:>:) :: a C(x y) -> FL a C(y z) -> FL a C(x z)
    NilFL :: FL a C(x x)

This gives an error with ghc-6.8.2 on Mac OS X (others have reported errors with 6.8.3 as well):

    Inferred type is less polymorphic than expected
      Quantified type variable `z2' escapes
    When checking an existential match that binds
        first_chs :: FL (TaggedPatch p) x z1
        last_chs :: FL (TaggedPatch p) z2 z
    The pattern(s) have type(s): (:>)
                                   (FL (TaggedPatch p))
                                   (FL (TaggedPatch p) :> FL (TaggedPatch p))
                                   x
                                   z
    The body has type: FL (TaggedPatch p) z2 z
    In a case alternative:
        (first_chs :> _ :> last_chs)
          -> if whichch == Last || whichch == FirstReversed then
                 last_chs
             else
                 first_chs
    In the expression:
        case get_choices pc of
          (first_chs :> _ :> last_chs)
            -> if whichch == Last || whichch == FirstReversed then
                   last_chs
               else
                   first_chs

I have been convinced that this is indeed a programming error by the fine people on #ghc. So the remaining question is: Why does it work on ghc-6.10.1?

I will try if I can construct a simpler test case.

Thanks,

Christian

Change History (1)

comment:1 Changed 6 years ago by ckeen

  • Resolution set to invalid
  • Status changed from new to closed

actually this has been identified as a user error.

Note: See TracTickets for help on using tickets.