+ | (Ast.Pattern (name',Some href,_),_) as branch :: tl ->
+ prerr_endline
+ (Printf.sprintf "analysis of %s and %s" name name');
+ (match href with
+ | NReference.Ref (curi, (NReference.Con (n,cno',_))) ->
+ (* check che la curi corrisponda alla uri del tipo induttivo *)
+ let this_indty = NReference.mk_indty true href in
+ if indtype_ref <> this_indty then
+ (prerr_endline "fail1";
+ raise (DisambiguateTypes.Invalid_choice
+ (lazy (loc, Printf.sprintf
+ "Malformed pattern matching: the matching type is %s, but constructor %s belongs to type %s."
+ (NReference.string_of_reference indtype_ref)
+ (NReference.string_of_reference href)
+ (NReference.string_of_reference this_indty)))))
+ else
+ if cno = cno' then (prerr_endline "ok";branch, tl)
+ else
+ (prerr_endline (Printf.sprintf "skip %d %d" cno cno');
+ let found,rest = find_and_remove tl in
+ found, branch::rest)
+ | _ ->
+ (prerr_endline "fail2";
+ raise
+ (DisambiguateTypes.Invalid_choice
+ (lazy (loc,"Malformed pattern: found " ^
+ (NReference.string_of_reference href) ^
+ " which is not a type constructor.")))))