Commit a023197b authored by Kim Nguyễn's avatar Kim Nguyễn

Add the possibility to enable all debugging code with the debug symbol "all".

Fix conditionaly compiled code, that contained type errors.
parent c9debef5
...@@ -61,7 +61,7 @@ EXTEND Caml_syntax.Gram ...@@ -61,7 +61,7 @@ EXTEND Caml_syntax.Gram
None -> "" None -> ""
| Some s -> s | Some s -> s
in in
if !debug && (flag = "" || List.mem flag !debug_symbols) then if !debug && (flag = "" || List.exists (fun s -> s = "all" || s = flag) !debug_symbols) then
e e
else <:expr< () >> else <:expr< () >>
] ]
......
...@@ -319,7 +319,7 @@ let rec norm delta mem t = ...@@ -319,7 +319,7 @@ let rec norm delta mem t =
V.(get (proj t)) V.(get (proj t))
in in
DEBUG normrec DEBUG normrec
(Format.eprintf "@[ - After %s constraints: %a @]@\n" (Format.eprintf "@[ - After %a constraints: %a @]@\n"
pp_type_kind V.kind ConstrSet.print res); pp_type_kind V.kind ConstrSet.print res);
res res
in in
...@@ -691,7 +691,7 @@ exception FoundApply of t * int * int * Descr.t Var.Map.map list ...@@ -691,7 +691,7 @@ exception FoundApply of t * int * int * Descr.t Var.Map.map list
let apply_raw delta s t = let apply_raw delta s t =
DEBUG apply_raw (Format.eprintf " @[Entering apply_raw (delta:@[%a@], @[%a@], @[%a@])@\n%!" DEBUG apply_raw (Format.eprintf " @[Entering apply_raw (delta:@[%a@], @[%a@], @[%a@])@\n%!"
Var.Set.pp delta Var.Set.print delta
Print.pp_type s Print.pp_type s
Print.pp_type t Print.pp_type t
); );
...@@ -738,11 +738,11 @@ let apply_raw delta s t = ...@@ -738,11 +738,11 @@ let apply_raw delta s t =
loop (i+1) loop (i+1)
with FoundApply (res, i, j, sl) -> with FoundApply (res, i, j, sl) ->
DEBUG apply_raw (Format.eprintf " Leaving apply_raw (delta:@[%a@], @[%a@], @[%a@]) = @[%a@], @[%a@] @]@\n%!" DEBUG apply_raw (Format.eprintf " Leaving apply_raw (delta:@[%a@], @[%a@], @[%a@]) = @[%a@], @[%a@] @]@\n%!"
Var.Set.pp delta Var.Set.print delta
Print.pp_type s Print.pp_type s
Print.pp_type t Print.pp_type t
Print.pp_type res Print.pp_type res
ConstrSet.printl sl pp_sl sl
); );
(sl, get ai i, get aj j, res) (sl, get ai i, get aj j, res)
in in
......
...@@ -3243,7 +3243,7 @@ struct ...@@ -3243,7 +3243,7 @@ struct
let _tlv,pos, neg, all = Variable.collect_vars t in let _tlv,pos, neg, all = Variable.collect_vars t in
DEBUG clean_type (Format.eprintf " - for type %a pos: %a, neg: %a, all: %a, tlv: %a@\n" DEBUG clean_type (Format.eprintf " - for type %a pos: %a, neg: %a, all: %a, tlv: %a@\n"
Print.pp_type t Print.pp_type t
Var.Set.pp pos Var.Set.pp neg Var.Set.pp all Var.Set.pp _tlv); Var.Set.print pos Var.Set.print neg Var.Set.print all Var.Set.print _tlv);
let vars = Var.Set.diff all delta in let vars = Var.Set.diff all delta in
if Var.Set.is_empty vars then t else if Var.Set.is_empty vars then t else
let subst = Map.init let subst = Map.init
...@@ -3259,7 +3259,7 @@ struct ...@@ -3259,7 +3259,7 @@ struct
let clean_type delta t = let clean_type delta t =
let res = clean_type delta t in let res = clean_type delta t in
DEBUG clean_type (Format.eprintf "@[ Calling clean_type(%a,@, %a) = %a@]@\n%!" DEBUG clean_type (Format.eprintf "@[ Calling clean_type(%a,@, %a) = %a@]@\n%!"
Var.Set.pp delta Print.pp_type t Print.pp_type res); Var.Set.print delta Print.pp_type t Print.pp_type res);
res res
......
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