From 0209fee47a11b371d258fe02b8cc59b325de21d6 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Thu, 7 Dec 2023 12:07:39 +0100 Subject: Use a better syntax when extracting tuple types (structures with unnamed fields) --- compiler/PureUtils.ml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'compiler/PureUtils.ml') diff --git a/compiler/PureUtils.ml b/compiler/PureUtils.ml index a5143f3c..39dcd52d 100644 --- a/compiler/PureUtils.ml +++ b/compiler/PureUtils.ml @@ -687,3 +687,14 @@ let trait_impl_is_empty (trait_impl : trait_impl) : bool = in parent_trait_refs = [] && consts = [] && types = [] && required_methods = [] && provided_methods = [] + +(** Return true if a type declaration should be extracted as a tuple, because + it is a non-recursive structure with unnamed fields. *) +let type_decl_from_type_id_is_tuple_struct (ctx : TypesAnalysis.type_infos) + (id : type_id) : bool = + match id with + | TTuple -> true + | TAdtId id -> + let info = TypeDeclId.Map.find id ctx in + info.is_tuple_struct + | TAssumed _ -> false -- cgit v1.2.3