src/Pure/sign.ML
changeset 171 ab0f93a291b5
parent 169 1b2765146aab
child 197 7c7179e687b2
equal deleted inserted replaced
170:590c9d1e0d73 171:ab0f93a291b5
   130       in typ_subst_TVars tye T end;
   130       in typ_subst_TVars tye T end;
   131 
   131 
   132     (*read and check the type mentioned in a const declaration; zero type var
   132     (*read and check the type mentioned in a const declaration; zero type var
   133       indices because type inference requires it*)
   133       indices because type inference requires it*)
   134 
   134 
   135     (* FIXME bug / feature: varifyT'ed TFrees may clash with user specified
       
   136       TVars e.g. foo :: "'a => ?'a" *)
       
   137     (* FIXME if user supplied TVars were disallowed, zero_tvar_indices would
       
   138       become obsolete *)
       
   139     (* FIXME disallow "" as const name *)
       
   140 
       
   141     fun read_consts tsg sy (cs, s) =
   135     fun read_consts tsg sy (cs, s) =
   142       let val ty = zero_tvar_indices (Type.varifyT (read_typ tsg sy s));
   136       let val ty = zero_tvar_indices (Type.varifyT (read_typ tsg sy s));
   143       in
   137       in
   144         (case Type.type_errors (tsg, Syntax.string_of_typ sy) (ty, []) of
   138         (case Type.type_errors (tsg, Syntax.string_of_typ sy) (ty, []) of
   145           [] => (cs, ty)
   139           [] => (cs, ty)
   162 
   156 
   163     val syn' = Syntax.extend syn read_ty (log_types, xconsts, sext);
   157     val syn' = Syntax.extend syn read_ty (log_types, xconsts, sext);
   164 
   158 
   165     val const_decs' =
   159     val const_decs' =
   166       map (read_consts tsig' syn') (Syntax.constants sext @ const_decs);
   160       map (read_consts tsig' syn') (Syntax.constants sext @ const_decs);
   167                     (* FIXME ^^^^ should be syn *)
       
   168   in
   161   in
   169     Sg {
   162     Sg {
   170       tsig = tsig',
   163       tsig = tsig',
   171       const_tab = Symtab.st_of_declist (const_decs', const_tab)
   164       const_tab = Symtab.st_of_declist (const_decs', const_tab)
   172         handle Symtab.DUPLICATE a => error ("Constant " ^ quote a ^ " declared twice"),
   165         handle Symtab.DUPLICATE a => error ("Constant " ^ quote a ^ " declared twice"),
   189  [(["fun"], 2),
   182  [(["fun"], 2),
   190   (["prop"], 0),
   183   (["prop"], 0),
   191   (Syntax.syntax_types, 0)],
   184   (Syntax.syntax_types, 0)],
   192  [(["fun"],  ([["logic"], ["logic"]], "logic")),
   185  [(["fun"],  ([["logic"], ["logic"]], "logic")),
   193   (["prop"], ([], "logic"))],
   186   (["prop"], ([], "logic"))],
   194  [([Syntax.constrainC], "'a::logic => 'a")],  (* FIXME replace logic by {} (?) *)
   187  [([Syntax.constrainC], "'a::logic => 'a")],
   195  Some Syntax.pure_sext);
   188  Some Syntax.pure_sext);
   196 
   189 
   197 
   190 
   198 
   191 
   199 (** The Merge operation **)
   192 (** The Merge operation **)