Skip to content

Commit

Permalink
Reenable type checking of local typed constants
Browse files Browse the repository at this point in the history
  • Loading branch information
lorchrob committed May 17, 2024
1 parent 88e52b0 commit 74b8aa0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lustre/lustreTypeChecker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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)) ->
Expand Down

0 comments on commit 74b8aa0

Please sign in to comment.