Skip to content
  • Simon Peyton Jones's avatar
    Fix PrelRules.caseRules to account for out-of-range tags · 9897f678
    Simon Peyton Jones authored
    As Trac #15436 points out, it is possible to get
       case dataToTag# (x :: T) of
          DEFAULT -> blah1
          -1#     -> blah2
          0       -> blah3
    
    The (-1#) alterantive is unreachable, because dataToTag# returns
    tags in the range [0..n-1] where n is the number of data constructors
    in type T.
    
    This actually made GHC crash; now we simply discard the unreachable
    alterantive.  See Note [Unreachable caseRules alternatives]
    in PrelRules
    9897f678