Project

General

Profile

Revision 5c1184ad src/typing.ml

View differences:

src/typing.ml
331 331
    expr.expr_type <- ty;
332 332
    ty
333 333
  | Expr_appl (id, args, r) ->
334
    (* application of non internal function is not legal in a constant expression *)
334
    (* application of non internal function is not legal in a constant
335
       expression *)
335 336
    (match r with
336 337
    | None        -> ()
337
    | Some (x, l) -> check_constant expr.expr_loc const false;
338
                     let expr_x = expr_of_ident x expr.expr_loc in	
339
		     let typ_l = Type_predef.type_clock (type_const expr.expr_loc (Const_tag l)) in
340
		     type_subtyping_arg env in_main ~sub:false const expr_x typ_l);
338
    | Some (x, l) -> 
339
      check_constant expr.expr_loc const false;
340
      let expr_x = expr_of_ident x expr.expr_loc in	
341
      let typ_l = 
342
	Type_predef.type_clock 
343
	  (type_const expr.expr_loc (Const_tag l)) in
344
      type_subtyping_arg env in_main ~sub:false const expr_x typ_l);
341 345
    let touts = type_appl env in_main expr.expr_loc const id args in
342 346
    expr.expr_type <- touts;
343 347
    touts
......
583 587
      type_imported_fun env nd decl.top_decl_loc
584 588
  | Consts clist ->
585 589
      type_top_consts env clist
586
  | Include _  -> env
590
  | Open _  -> env
587 591

  
588 592
let type_prog env decls =
589 593
try
590
  ignore(List.fold_left type_top_decl env decls)
594
  List.fold_left type_top_decl env decls
591 595
with Failure _ as exc -> raise exc
592 596

  
593 597
(* Once the Lustre program is fully typed,
......
632 636
  | ImportedFun nd ->
633 637
      ()
634 638
  | Consts clist -> ()
635
  | Include _  -> ()
639
  | Open _  -> ()
636 640

  
637 641
let uneval_prog_generics prog =
638 642
 List.iter uneval_top_generics prog
643

  
644
let check_env_compat declared computed =
645
  Env.iter declared (fun k decl_type_k -> 
646
    let computed_t = Env.lookup_value computed k in
647
    try_unify decl_type_k computed_t Location.dummy_loc
648
  ) 
649

  
639 650
(* Local Variables: *)
640 651
(* compile-command:"make -C .." *)
641 652
(* End: *)

Also available in: Unified diff