Project

General

Profile

Revision 8b3afe43 src/typing.ml

View differences:

src/typing.ml
212 212
        t2.tdesc <- Tlink t1
213 213
    | Tarrow (t1,t2), Tarrow (t1',t2') ->
214 214
      begin
215
        unify t1 t1';
216
	unify t2 t2'
215
        semi_unify t1 t1';
216
	semi_unify t2 t2'
217 217
      end
218 218
    | Ttuple tlist1, Ttuple tlist2 ->
219 219
        if (List.length tlist1) <> (List.length tlist2) then
......
237 237
    | Tarray (e1, t1'), Tarray (e2, t2') ->
238 238
      begin
239 239
	semi_unify t1' t2';
240
	Dimension.eval Basic_library.eval_env (fun c -> None) e1;
241
	Dimension.eval Basic_library.eval_env (fun c -> None) e2;
240
	Dimension.eval Basic_library.eval_env (fun c -> Some (Dimension.mkdim_ident Location.dummy_loc c)) e1;
241
	Dimension.eval Basic_library.eval_env (fun c -> Some (Dimension.mkdim_ident Location.dummy_loc c)) e2;
242 242
	Dimension.semi_unify e1 e2;
243 243
      end
244 244
    | _,_ -> raise (Unify (t1, t2))
......
252 252
  | Dimension.Unify _ ->
253 253
    raise (Error (loc, Type_clash (ty1,ty2)))
254 254

  
255
let try_semi_unify ty1 ty2 loc =
256
  try
257
    semi_unify ty1 ty2
258
  with
259
  | Unify _ ->
260
    raise (Error (loc, Type_clash (ty1,ty2)))
261
  | Dimension.Unify _ ->
262
    raise (Error (loc, Type_clash (ty1,ty2)))
263

  
255 264
let rec type_const loc c = 
256 265
  match c with
257 266
  | Const_int _ -> Type_predef.type_int
......
516 525
		 expr_annot = None})
517 526
          dummy_id_expr cl
518 527
      in
519
Format.eprintf "yiihii@.";
520 528
      ignore (type_expr env false false when_expr)
521 529

  
522 530
let rec check_type_declaration loc cty =
......
709 717
let uneval_prog_generics prog =
710 718
 List.iter uneval_top_generics prog
711 719

  
712
let check_env_compat declared computed =
720
let check_env_compat header declared computed =
721
  (try 
722
     uneval_prog_generics header
723
   with e -> raise e);
713 724
  Env.iter declared (fun k decl_type_k -> 
714
    let computed_t = Env.lookup_value computed k in
715
    try_unify decl_type_k computed_t Location.dummy_loc
725
    let computed_t = instantiate (ref []) (ref []) (Env.lookup_value computed k) in
726
    (*Types.print_ty Format.std_formatter decl_type_k;
727
    Types.print_ty Format.std_formatter computed_t;*)
728
    try_semi_unify decl_type_k computed_t Location.dummy_loc
716 729
  ) 
717 730

  
718 731
(* Local Variables: *)

Also available in: Unified diff