Project

General

Profile

« Previous | Next » 

Revision 11242500

Added by Xavier Thirioux over 9 years ago

again, debugged tuple subtyping

git-svn-id: https://cavale.enseeiht.fr/svn/lustrec/lustre_compiler/trunk@160 041b043f-8d7c-46b2-b46e-ef0dd855326e

View differences:

src/typing.ml
307 307
	 real_static_type
308 308
    else real_type in
309 309
(*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;*)
310
  let real_types   = type_list_of_type real_type in
311
  let formal_types = type_list_of_type formal_type in
312
  try
313
    List.iter2 (type_subtyping loc sub) real_types formal_types
314
  with _ -> raise (Unify (real_type, formal_type))
315

  
316
and type_subtyping loc sub real_type formal_type =
310 317
  match (repr real_type).tdesc, (repr formal_type).tdesc with
311 318
  | Tstatic _          , Tstatic _ when sub -> try_unify formal_type real_type loc
312 319
  | Tstatic (r_d, r_ty), _         when sub -> try_unify formal_type r_ty loc
......
486 493
    List.fold_left (fun uvars v -> define_var v uvars) undefined_vars eq.eq_lhs in
487 494
  (* Type rhs wrt to lhs type with subtyping, i.e. a constant rhs value may be assigned
488 495
     to a (always non-constant) lhs variable *)
489
  let tins = type_list_of_type ty_lhs in
490
  let args = expr_list_of_expr eq.eq_rhs in
491
  List.iter2 (type_subtyping_arg env in_main false) args tins;
496
  type_subtyping_arg env in_main false eq.eq_rhs ty_lhs;
492 497
  undefined_vars
493 498

  
494 499

  

Also available in: Unified diff