src/Pure/Syntax/syntax_phases.ML
changeset 45448 018f8959c7a6
parent 45447 a97251eea458
child 45453 304437f43869
equal deleted inserted replaced
45447:a97251eea458 45448:018f8959c7a6
   807           | TVar v => constraint v
   807           | TVar v => constraint v
   808           | _ => I) tys [];
   808           | _ => I) tys [];
   809     val get_sort = Proof_Context.get_sort ctxt env;
   809     val get_sort = Proof_Context.get_sort ctxt env;
   810   in
   810   in
   811     (map o map_atyps)
   811     (map o map_atyps)
   812       (fn TFree (x, _) => TFree (x, get_sort (x, ~1))
   812       (fn T =>
   813         | TVar (xi, _) => TVar (xi, get_sort xi)
   813         if Term_Position.is_positionT T then T
   814         | T => T) tys
   814         else
       
   815           (case T of
       
   816             TFree (x, _) => TFree (x, get_sort (x, ~1))
       
   817           | TVar (xi, _) => TVar (xi, get_sort xi)
       
   818           | _ => T)) tys
   815   end;
   819   end;
   816 
   820 
   817 in
   821 in
   818 
   822 
   819 fun check_typs ctxt =
   823 fun check_typs ctxt =
   821   apply_typ_check ctxt #>
   825   apply_typ_check ctxt #>
   822   Term_Sharing.typs (Proof_Context.theory_of ctxt);
   826   Term_Sharing.typs (Proof_Context.theory_of ctxt);
   823 
   827 
   824 fun check_terms ctxt raw_ts =
   828 fun check_terms ctxt raw_ts =
   825   let
   829   let
   826     val (ts, ps) = Type_Infer_Context.prepare_positions ctxt raw_ts;
   830     val (ts, ps) = raw_ts
       
   831       |> Term.burrow_types (prepare_sorts ctxt)
       
   832       |> Type_Infer_Context.prepare_positions ctxt;
   827     val tys = map (Logic.mk_type o snd) ps;
   833     val tys = map (Logic.mk_type o snd) ps;
   828     val (ts', tys') =
   834     val (ts', tys') = ts @ tys
   829       Term.burrow_types (prepare_sorts ctxt) ts @ tys
       
   830       |> apply_term_check ctxt
   835       |> apply_term_check ctxt
   831       |> chop (length ts);
   836       |> chop (length ts);
   832     val _ =
   837     val _ =
   833       map2 (fn (pos, _) => fn ty =>
   838       map2 (fn (pos, _) => fn ty =>
   834         if Position.is_reported pos then
   839         if Position.is_reported pos then