Project

General

Profile

Revision 53206908 src/typing.ml

View differences:

src/typing.ml
103 103
  | Tydec_any -> new_var ()
104 104
  | Tydec_int -> Type_predef.type_int
105 105
  | Tydec_real -> Type_predef.type_real
106
  | Tydec_float -> Type_predef.type_real
106
  (* | Tydec_float -> Type_predef.type_real *)
107 107
  | Tydec_bool -> Type_predef.type_bool
108 108
  | Tydec_clock ty -> Type_predef.type_clock (type_coretype type_dim ty)
109 109
  | Tydec_const c -> Type_predef.type_const c
......
261 261
  match c with
262 262
  | Const_int _     -> Type_predef.type_int
263 263
  | Const_real _    -> Type_predef.type_real
264
  | Const_float _   -> Type_predef.type_real
264
  (* | Const_float _   -> Type_predef.type_real *)
265 265
  | Const_array ca  -> let d = Dimension.mkdim_int loc (List.length ca) in
266 266
		      let ty = new_var () in
267 267
		      List.iter (fun e -> try_unify ty (type_const loc e) loc) ca;
......
344 344
*)
345 345
and type_appl env in_main loc const f args =
346 346
  let targs = List.map (type_expr env in_main const) args in
347
  if Basic_library.is_internal_fun f && List.exists is_tuple_type targs
347
  if Basic_library.is_homomorphic_fun f && List.exists is_tuple_type targs
348 348
  then
349 349
    try
350 350
      let targs = Utils.transpose_list (List.map type_list_of_type targs) in
......
367 367
    begin
368 368
      List.iter2 (fun (a,t) ti ->
369 369
	let t' = type_add_const env (const || Types.get_static_value ti <> None) a t
370
	in try_unify ~sub:true ti t' a.expr_loc;
371
      ) targs tins;
372
(*Format.eprintf "Typing.type_dependent_call END@.";*)
373
      touts;
370
	in try_unify ~sub:true ti t' a.expr_loc) targs tins;
371
      touts
374 372
    end
375 373

  
376 374
(* type a simple call without dependent types 
......
575 573
  let type_dim d =
576 574
    begin
577 575
      type_subtyping_arg (env, vd_env) false true (expr_of_dimension d) Type_predef.type_int;
578

  
579 576
      Dimension.eval Basic_library.eval_env eval_const d;
580 577
    end in
581 578
  let ty = type_coretype type_dim vdecl.var_dec_type.ty_dec_desc in
582 579

  
583 580
  let ty_static =
584 581
    if vdecl.var_dec_const
585
    then  Type_predef.type_static (Dimension.mkdim_var ()) ty
582
    then Type_predef.type_static (Dimension.mkdim_var ()) ty
586 583
    else ty in
587 584
  (match vdecl.var_dec_value with
588 585
  | None   -> ()
......
680 677
let rec type_top_decl env decl =
681 678
  match decl.top_decl_desc with
682 679
  | Node nd -> (
683
      try
684
	type_node env nd decl.top_decl_loc
685
      with Error (loc, err) as exc -> (
686
	(*if !Options.global_inline then
687
	  Format.eprintf "Type error: failing node@.%a@.@?"
688
	    Printers.pp_node nd
689
	;*)
690
	raise exc)
680
    try
681
      type_node env nd decl.top_decl_loc
682
    with Error (loc, err) as exc -> (
683
      if !Options.global_inline then
684
	Format.eprintf "Type error: failing node@.%a@.@?"
685
	  Printers.pp_node nd
686
      ;
687
      raise exc)
691 688
  )
692 689
  | ImportedNode nd ->
693
      type_imported_node env nd decl.top_decl_loc
690
    type_imported_node env nd decl.top_decl_loc
694 691
  | Const c ->
695
      type_top_const env c
692
    type_top_const env c
696 693
  | TypeDef _ -> List.fold_left type_top_decl env (consts_of_enum_type decl)
697 694
  | Open _  -> env
698 695

  

Also available in: Unified diff