···10091009 modules, polymorphic fields or methods, and constrained type parameters.
10101010 (Florian Angeletti, review by Gabriel Scherer)
1011101110121012+- #14196, #14197: ocamlprof: do not instrument unreachable clauses
10131013+ (Gabriel Scherer, review by Nicolás Ojeda Bär, report by Ali Caglayan)
10141014+10121015OCaml 5.3.0 (8 January 2025)
10131016----------------------------
10141017
+15-4
tools/ocamlprof.ml
···154154let rec rewrite_patexp_list iflag l =
155155 rewrite_exp_list iflag (List.map (fun x -> x.pvb_expr) l)
156156157157+and rewrite_case_body iflag rhs =
158158+ match rhs.pexp_desc with
159159+ | Pexp_unreachable -> ()
160160+ | _ -> rewrite_exp iflag rhs
161161+157162and rewrite_cases iflag l =
158163 List.iter
159164 (fun pc ->
···161166 | None -> ()
162167 | Some g -> rewrite_exp iflag g
163168 end;
164164- rewrite_exp iflag pc.pc_rhs
169169+ rewrite_case_body iflag pc.pc_rhs
165170 )
166171 l
167172···313318 (function
314319 | {guard=Some scond; rhs=sbody} ->
315320 insert_profile rw_exp scond;
316316- insert_profile rw_exp sbody;
321321+ rewrite_annotate_rhs sbody
317322 | {rhs={pexp_desc = Pexp_constraint(sbody, _)}} (* let f x : t = e *)
318318- -> insert_profile rw_exp sbody
319319- | {rhs=sexp} -> insert_profile rw_exp sexp)
323323+ -> rewrite_annotate_rhs sbody
324324+ | {rhs=sexp} -> rewrite_annotate_rhs sexp
325325+ )
320326 l
327327+328328+and rewrite_annotate_rhs rhs =
329329+ match rhs.pexp_desc with
330330+ | Pexp_unreachable -> ()
331331+ | _ -> insert_profile rw_exp rhs
321332322333and rewrite_function iflag = function
323334 | [{guard=None;