12345678910111213141516171819202122232425262728293031323334353637383940414243(**************************************************************************)(* *)(* OCaml *)(* *)(* Gabriel Scherer, projet Parsifal, INRIA Saclay *)(* Rodolphe Lepigre, projet Deducteam, INRIA Saclay *)(* *)(* Copyright 2018 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)openTypes(* We use the Ctype.expand_head_opt version of expand_head to get access
to the manifest type of private abbreviations. *)letrecget_unboxed_type_representationenvtyfuel=iffuel<0thenNoneelseletty=Ctype.expand_head_optenvtyinmatchget_desctywith|Tconstr(p,args,_)->beginmatchEnv.find_typepenvwith|exceptionNot_found->Somety|{type_params;type_kind=Type_record([{ld_type=ty2;_}],Record_unboxed_)|Type_variant([{cd_args=Cstr_tuple[ty2];_}],Variant_unboxed)|Type_variant([{cd_args=Cstr_record[{ld_type=ty2;_}];_}],Variant_unboxed)}->letty2=matchget_descty2withTpoly(t,_)->t|_->ty2inget_unboxed_type_representationenv(Ctype.applyenvtype_paramsty2args)(fuel-1)|_->Sometyend|_->Sometyletget_unboxed_type_representationenvty=(* Do not give too much fuel: PR#7424 *)get_unboxed_type_representationenvty100