diff options
Diffstat (limited to 'pretyping')
-rw-r--r-- | pretyping/detyping.ml | 4 | ||||
-rw-r--r-- | pretyping/pretyping.ml | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/pretyping/detyping.ml b/pretyping/detyping.ml index f0203fa2c..b6ec16925 100644 --- a/pretyping/detyping.ml +++ b/pretyping/detyping.ml @@ -321,6 +321,8 @@ let detype_case computable detype detype_eqns testdep avoid data p c bl = try if !Flags.raw_print then RegularStyle + else if st = LetPatternStyle then + st else if PrintingLet.active (indsp,consnargsl) then LetStyle else if PrintingIf.active (indsp,consnargsl) then @@ -334,6 +336,8 @@ let detype_case computable detype detype_eqns testdep avoid data p c bl = let bl' = Array.map detype bl in let (nal,d) = it_destRLambda_or_LetIn_names consnargsl.(0) bl'.(0) in RLetTuple (dl,nal,(alias,pred),tomatch,d) + | LetPatternStyle when List.length eqnl = 1 -> (* If irrefutable due to some inversion, print as match *) + RLetPattern (dl,(tomatch,(alias,aliastyp)),List.hd eqnl) | IfStyle when aliastyp = None -> let bl' = Array.map detype bl in let nondepbrs = diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml index db492c026..e30f553fe 100644 --- a/pretyping/pretyping.ml +++ b/pretyping/pretyping.ml @@ -588,7 +588,14 @@ module Pretyping_F (Coercion : Coercion.S) = struct let j = pretype tycon env evdref lvar (RCases (loc, None, [c], [p])) - in j + in + (* Change case info *) + let j' = match kind_of_term j.uj_val with + Case (ci, po, c, br) -> + let pp_info = { ci.ci_pp_info with style = LetPatternStyle } in + { j with uj_val = mkCase ({ ci with ci_pp_info = pp_info }, po, c, br) } + | _ -> j + in j' | RCases (loc,po,tml,eqns) -> Cases.compile_cases loc |