Project

General

Profile

Revision a1daa793 src/typing.ml

View differences:

src/typing.ml
336 336
  (*Format.eprintf "subtyping const %B real %a:%a vs formal %a@." const Printers.pp_expr real_arg Types.print_ty real_type Types.print_ty formal_type;*)
337 337
  try_unify ~sub:sub formal_type real_type loc
338 338

  
339
and type_ident env in_main loc const id =
340
  type_expr env in_main const (expr_of_ident id loc)
341

  
342 339
(* typing an application implies:
343 340
   - checking that const formal parameters match real const (maybe symbolic) arguments
344 341
   - checking type adequation between formal and real arguments
......
452 449
    | Some c -> 
453 450
      check_constant expr.expr_loc const false;	
454 451
      type_subtyping_arg env in_main const c Type_predef.type_bool);
455
    let touts = type_appl env in_main expr.expr_loc const id (expr_list_of_expr args) in
452
    let args_list = expr_list_of_expr args in
453
    let touts = type_appl env in_main expr.expr_loc const id args_list in
454
    args.expr_type <- new_ty (Ttuple (List.map (fun a -> a.expr_type) args_list));
456 455
    expr.expr_type <- touts;
457 456
    touts
458 457
  | Expr_fby (e1,e2)
......
697 696
  | TypeDef _ -> List.fold_left type_top_decl env (consts_of_enum_type decl)
698 697
  | Open _  -> env
699 698

  
699
let get_type_of_call decl =
700
  match decl.top_decl_desc with
701
  | Node nd         ->
702
    let (in_typ, out_typ) = split_arrow nd.node_type in
703
    type_list_of_type in_typ, type_list_of_type out_typ
704
  | ImportedNode nd ->
705
    let (in_typ, out_typ) = split_arrow nd.nodei_type in
706
    type_list_of_type in_typ, type_list_of_type out_typ
707
  | _               -> assert false
708

  
700 709
let type_prog env decls =
701 710
try
702 711
  List.fold_left type_top_decl env decls

Also available in: Unified diff