Commit e036e995 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-05-10 22:08:59 by cvscast] Detect empty types declarations

Original author: cvscast
Date: 2003-05-10 22:08:59+00:00
parent 87214f7b
......@@ -5,6 +5,12 @@
*)
let warning loc msg =
Format.fprintf !Location.warning_ppf "Warning %a:@\n%a%s@\n"
Location.print_loc loc
Location.html_hilight loc
msg
(* I. Transform the abstract syntax of types and patterns into
the internal form *)
......@@ -450,10 +456,14 @@ let register_global_types b =
let b = List.map (fun (v,p) -> (v,p,compile (derecurs !glb p))) b in
flush_defs ();
flush_fv ();
List.iter (fun (v,p,s) ->
if not (IdSet.is_empty (fv_descr s)) then
raise_loc_generic p.loc "Capture variables are not allowed in types";
Types.Print.register_global v (typ s)) b
List.iter
(fun (v,p,s) ->
if not (IdSet.is_empty (fv_descr s)) then
raise_loc_generic p.loc "Capture variables are not allowed in types";
let t = typ s in
if (p.loc <> noloc) && (Types.is_empty t) then
warning p.loc ("This definition yield an empty type for " ^ v);
Types.Print.register_global v t) b
let dump_global_types ppf =
TypeEnv.iter (fun v _ -> Format.fprintf ppf " %s" v) !glb
......@@ -617,11 +627,6 @@ let match_fail = ref Types.empty
open Typed
let warning loc msg =
Format.fprintf !Location.warning_ppf "Warning %a:@\n%a%s@\n"
Location.print_loc loc
Location.html_hilight loc
msg
let check loc t s msg =
if not (Types.subtype t s) then raise_loc loc (Constraint (t, s, msg))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment