From c2d6105736ae7ffe7626f6993363d26b2ed50b2e Mon Sep 17 00:00:00 2001 From: Daniel Larraz Date: Wed, 1 Nov 2023 21:44:30 -0500 Subject: [PATCH] No inlining for enum types --- src/lustre/lustreAstInlineConstants.ml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lustre/lustreAstInlineConstants.ml b/src/lustre/lustreAstInlineConstants.ml index 5b2aa99ee..4c4dff98e 100644 --- a/src/lustre/lustreAstInlineConstants.ml +++ b/src/lustre/lustreAstInlineConstants.ml @@ -488,8 +488,16 @@ let rec inline_constants_of_contract: TC.tc_context -> LA.contract -> LA.contrac let substitute: TC.tc_context -> LA.declaration -> (TC.tc_context * LA.declaration) = fun ctx -> function | TypeDecl (span, AliasType (pos, i, t)) -> - let t' = inline_constants_of_lustre_type ctx t in - TC.add_ty_syn ctx i t', LA.TypeDecl (span, AliasType (pos, i, t')) + let ctx', t' = + match t with + | LA.EnumType _ -> + (* Special handling is applied to enum types (see type_check_infer_globals) *) + ctx, t + | _ -> + let t' = inline_constants_of_lustre_type ctx t in + TC.add_ty_syn ctx i t', t' + in + ctx', LA.TypeDecl (span, AliasType (pos, i, t')) | ConstDecl (span, FreeConst (pos, id, ty)) -> let ty' = inline_constants_of_lustre_type ctx ty in ctx, ConstDecl (span, FreeConst (pos, id, ty'))