From 74b8aa07cfbc452123c2922f3889962b95c3c637 Mon Sep 17 00:00:00 2001 From: Rob Lorch Date: Fri, 17 May 2024 14:56:07 -0500 Subject: [PATCH] Reenable type checking of local typed constants --- src/lustre/lustreTypeChecker.ml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lustre/lustreTypeChecker.ml b/src/lustre/lustreTypeChecker.ml index a1ae90ccf..e593b53b9 100644 --- a/src/lustre/lustreTypeChecker.ml +++ b/src/lustre/lustreTypeChecker.ml @@ -1183,11 +1183,12 @@ and check_type_node_decl: Lib.position -> tc_context -> LA.node_decl -> ([> warn else ( (* Add local variable bindings to the context *) let local_ctx = add_local_node_ctx ctx_plus_ops_and_ips ldecls in - (* Check well-formedness of locals' types *) + (* Check locals' types and their well-formedness *) let* warnings = R.seq (List.map (fun local_decl -> match local_decl with - | LA.NodeConstDecl (_, TypedConst (_, _, e, ty)) -> - let* _ = (check_expr_is_constant local_ctx "constant definition" e) in - (check_type_well_formed local_ctx Local (Some node_name) true ty) + | LA.NodeConstDecl (_, (TypedConst (_, i, e, ty))) -> + let* _ = check_expr_is_constant local_ctx "constant definition" e in + let* _ = check_type_expr (add_ty local_ctx i ty) e ty in + check_type_well_formed local_ctx Local (Some node_name) true ty | LA.NodeVarDecl (_, (_, _, ty, _)) -> check_type_well_formed local_ctx Local (Some node_name) false ty | LA.NodeConstDecl (_, FreeConst (_, _, ty)) ->