Commit f1b1d5f0 authored by simonmar's avatar simonmar

[project @ 2000-02-25 10:49:30 by simonmar]

Make the desugarer a little more liberal about the class of case
expressions which get the special unboxed tuple treatment.
parent fc43d814
......@@ -301,8 +301,8 @@ dsExpr (HsSCC cc expr)
-- special case to handle unboxed tuple patterns.
dsExpr (HsCase discrim matches@[Match _ [TuplePat ps boxed] _ _] src_loc)
| not boxed && all var_pat ps
dsExpr (HsCase discrim matches src_loc)
| all ubx_tuple_match matches
= putSrcLocDs src_loc $
dsExpr discrim `thenDs` \ core_discrim ->
matchWrapper CaseMatch matches "case" `thenDs` \ ([discrim_var], matching_code) ->
......@@ -310,6 +310,9 @@ dsExpr (HsCase discrim matches@[Match _ [TuplePat ps boxed] _ _] src_loc)
Case (Var x) bndr alts | x == discrim_var ->
returnDs (Case core_discrim bndr alts)
_ -> panic ("dsExpr: tuple pattern:\n" ++ showSDoc (ppr matching_code))
where
ubx_tuple_match (Match _ [TuplePat ps False{-unboxed-}] _ _) = True
ubx_tuple_match _ = False
dsExpr (HsCase discrim matches src_loc)
= putSrcLocDs src_loc $
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment