summaryrefslogtreecommitdiff
path: root/compiler/PureUtils.ml
diff options
context:
space:
mode:
authorSon Ho2023-12-07 12:07:39 +0100
committerSon Ho2023-12-07 12:07:39 +0100
commit0209fee47a11b371d258fe02b8cc59b325de21d6 (patch)
tree9e23c2618c7138a02be28310eb8deaac2b4b3c5c /compiler/PureUtils.ml
parenteb05c2e3b63377c323c33c1296495baa9357596a (diff)
Use a better syntax when extracting tuple types (structures with unnamed fields)
Diffstat (limited to '')
-rw-r--r--compiler/PureUtils.ml11
1 files changed, 11 insertions, 0 deletions
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