From ce535c5a185413bc1a4a4f2fef3f1d1623ed72ef Mon Sep 17 00:00:00 2001
From: Pascal Raymond <Pascal.Raymond@imag.fr>
Date: Thu, 12 Jul 2012 19:50:52 +0200
Subject: [PATCH] DoNoPoly avance doucement ...

---
 src/doNoPoly.ml          | 50 ++++++++++++++++++++++++----------------
 src/eff.ml               |  2 +-
 src/evalClock.ml         |  2 +-
 src/evalType.ml          |  7 +++---
 src/getEff.ml            |  4 ++--
 src/inline.ml            | 36 ++++++++++++++---------------
 src/licDump.ml           | 16 ++++++-------
 src/nodesExpand.ml       |  2 +-
 src/split.ml             | 14 +++++------
 src/structArrayExpand.ml |  8 +++----
 src/unifyClock.ml        |  6 ++---
 11 files changed, 79 insertions(+), 68 deletions(-)

diff --git a/src/doNoPoly.ml b/src/doNoPoly.ml
index 4333f69d..7fcce690 100644
--- a/src/doNoPoly.ml
+++ b/src/doNoPoly.ml
@@ -45,27 +45,24 @@ let rec doit (inp : LicPrg.t) : LicPrg.t =
       if Eff.node_is_poly ne then
          Verbose.printf ~flag:dbg "#DBG: (No Poly) node %s is POLY\n"
             (Eff.string_of_node_key ne.node_key_eff)
-      else
+      else (
          Verbose.printf ~flag:dbg "#DBG: (No Poly) node %s is NOT poly\n"
             (Eff.string_of_node_key ne.node_key_eff);
          let def' = match ne.def_eff with
          | ExternEff -> ne.def_eff 
          | AbstractEff _ -> assert false
          | BodyEff nb ->
-            BodyEff (do_body None None nb)
+            BodyEff (do_body nb)
          in
          ()
+      )
 
    (** TRAITEMENT DES BODY *)
    and do_body
-      (a_is: Eff.type_ option)
-      (an_is: Eff.type_ option)
       (nb: Eff.node_body) : Eff.node_body =
       (* parcours les expressions du body
          à la recherche d'appel ne noeuds poly *)
-      let rec do_exp e =
-         e
-      and do_assert a =
+      let do_assert a =
          Lxm.flagit (
             do_exp a.it
          ) a.src
@@ -79,29 +76,42 @@ let rec doit (inp : LicPrg.t) : LicPrg.t =
          asserts_eff = List.map do_assert nb.asserts_eff;
          eqs_eff = List.map do_eq nb.eqs_eff;
       }
-
-   (* TRAITEMENT DES EXP *)
-   and do_exp a_is an_is e =
-      let typ' = List.map (do_type a_is an_is) e.ve_typ in
+   (* TRAITEMENT DES EXP : on passe en parametre un Eff.type_matches *)
+   and do_exp (e: Eff.val_exp) =
+      let typ' = e.ve_typ in
       let core' = match e.ve_core with
       | CallByPosEff (posop, OperEff ops) -> (
-         let ops' = OperEff (List.map (do_exp a_is an_is) ops) in
+         let ops' = OperEff (List.map do_exp ops) in
          match posop.it with
-         | Predef (pop,sas) ->
-            (* pop : Predef.op *) 
-            assert false
+         | PREDEF_CALL (pop,sas) ->
+            (* pop : Predef.op *)
+            (* un des arguments stat est un noeud poly ? *)
+            let check_sa = function
+               | NodeStaticArgEff (id, (nk, ins,outs), nexp) ->
+                  if Eff.node_is_poly nexp then (
+                     Printf.fprintf stderr "#DBG: CALL predef node %s uses poly node %s\n"
+                        (Lxm.details posop.src)
+                        (Eff.string_of_node_key nk)
+                  ) else ()
+               | _ -> ()
+            in
+            Verbose.exe ~flag:dbg (fun () -> List.iter check_sa sas);
+            CallByPosEff (posop, ops')
          | CALL ne ->
             (* ne: node_exp srcflagged *)
-            if Eff.node_is_poly ne.it then
-               assert false
-            else
+            if Eff.node_is_poly ne.it then (
+               Verbose.exe ~flag:dbg (fun () ->
+                  Printf.fprintf stderr "#DBG: CALL poly node %s\n" (Lxm.details posop.src)
+               );
+               CallByPosEff (posop, ops')
+            ) else
                CallByPosEff (posop, ops')
          | x ->
             (* dans tout les autre cas, raf ? *)
-            CallByPosEff (flagit x posop.src, ops')
+            CallByPosEff (posop, ops')
       )
       | CallByNameEff (namop, idops) ->
-      assert false
+         assert false
       in
       { e with ve_core = core'; ve_typ = typ' }
 
diff --git a/src/eff.ml b/src/eff.ml
index f686c710..35742f3b 100644
--- a/src/eff.ml
+++ b/src/eff.ml
@@ -195,7 +195,7 @@ and by_name_op =
 
 
 and by_pos_op =
-  | Predef of Predef.op * static_arg list
+  | PREDEF_CALL of Predef.op * static_arg list
   | CALL of node_exp srcflagged
   | IDENT of Ident.idref (* should be an Ident.t or long, really... *)
 
diff --git a/src/evalClock.ml b/src/evalClock.ml
index 088750c1..6a84bc24 100644
--- a/src/evalClock.ml
+++ b/src/evalClock.ml
@@ -371,7 +371,7 @@ and (eval_by_pos_clock : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> Eff.val_exp
           let (_,clk,s) = f_aux id_solver s (List.hd args) in
             clk,s  
 
-      | Eff.Predef (op,sargs),args  -> 
+      | Eff.PREDEF_CALL (op,sargs),args  -> 
           let args, clk_args, s =  f_list id_solver s args in
           let flat_clk_args = List.flatten clk_args in (* => mono-clock! *)
           let _,flat_clk_args = List.split flat_clk_args in
diff --git a/src/evalType.ml b/src/evalType.ml
index e571a298..f8deb1fb 100644
--- a/src/evalType.ml
+++ b/src/evalType.ml
@@ -64,7 +64,7 @@ and eval_by_pos_type
       * Eff.type_ list     (* The type of the val_exp "posop(args)" *)
   ) =
     match posop with
-      | Eff.Predef (op,sargs) -> (
+      | PREDEF_CALL (op,sargs) -> (
           let args, targs = List.split (List.map (f id_solver) args) in
           (* ICI pas de matches possible ? *)
           let tve = PredefEvalType.f op lxm sargs targs in
@@ -91,8 +91,9 @@ and eval_by_pos_type
             | [] -> lto
             | _  -> 
                Verbose.exe ~flag:dbgpoly (fun () ->
-                  Printf.fprintf stderr "#DBG: EvalType of CALL '%s'\n"
-                     (Eff.string_of_node_key node_exp_eff.it.node_key_eff) ;
+                  Printf.fprintf stderr "#DBG: EvalType of CALL '%s' (%s)\n"
+                     (Eff.string_of_node_key node_exp_eff.it.node_key_eff) 
+                     (Lxm.details lxm);
                   Printf.fprintf stderr "#     unifying '%s' with '%s'\n"
                      (Eff.string_of_type_list lti)
                      (Eff.string_of_type_list t_args) ;
diff --git a/src/getEff.ml b/src/getEff.ml
index 80dc47a1..1629d9f8 100644
--- a/src/getEff.ml
+++ b/src/getEff.ml
@@ -367,7 +367,7 @@ and (translate_val_exp : Eff.id_solver -> UnifyClock.subst ->
                    try translate_predef_macro id_solver lxm op sargs (s, vel_eff)
                    with Not_found -> 
                       assert (sargs=[]);
-                      s, mk_by_pos_op(Predef (op,[]))
+                      s, mk_by_pos_op(PREDEF_CALL (op,[]))
                    )
                 | CALL_n node_exp_f -> 
                     let neff = of_node id_solver node_exp_f in
@@ -535,7 +535,7 @@ and translate_predef_macro id_solver lxm zemacro sargs (s,vel_eff) =
 *)
    let mk_by_pos_op by_pos_op_eff =
       CallByPosEff(flagit by_pos_op_eff lxm, OperEff vel_eff)
-   in s, mk_by_pos_op (Eff.Predef(zemacro, sargs_eff)) 
+   in s, mk_by_pos_op (Eff.PREDEF_CALL(zemacro, sargs_eff)) 
 
 and translate_by_name_op id_solver op = 
   match op.it with
diff --git a/src/inline.ml b/src/inline.ml
index deb59c3d..bfb225c8 100644
--- a/src/inline.ml
+++ b/src/inline.ml
@@ -75,7 +75,7 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
         | CallByPosEff(
             {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "map"),sargs)}})}, 
             OperEff args)
-        | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.Map, sargs)}, OperEff args) 
+        | CallByPosEff({src=lxm_ve;it=Eff.PREDEF_CALL(Predef.Map, sargs)}, OperEff args) 
           -> 
 	    (* Given
 	       - a node n of type: tau_1 * ... * tau_n -> teta_1 * ... * teta_l
@@ -141,9 +141,9 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
             {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "fillred"),sargs)}})}, 
             OperEff args)
 
-        | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.Fill,   sargs)}, OperEff args) 
-        | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.Red,    sargs)}, OperEff args) 
-        | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.FillRed,sargs)}, OperEff args) 
+        | CallByPosEff({src=lxm_ve;it=Eff.PREDEF_CALL(Predef.Fill,   sargs)}, OperEff args) 
+        | CallByPosEff({src=lxm_ve;it=Eff.PREDEF_CALL(Predef.Red,    sargs)}, OperEff args) 
+        | CallByPosEff({src=lxm_ve;it=Eff.PREDEF_CALL(Predef.FillRed,sargs)}, OperEff args) 
           -> 
             (* Given 
                - a node n of type 
@@ -251,7 +251,7 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
         | CallByPosEff(
             {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "diese"),_)}})}, 
             OperEff args)
-        | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.DIESE_n,_)}, OperEff args) ->
+        | CallByPosEff({src=lxm_ve;it=Eff.PREDEF_CALL(Predef.DIESE_n,_)}, OperEff args) ->
             (* a diese is a particular kind of boolred:
                #(A,...,an) = boolred(1,1,n)([a1,...,an])
             *)
@@ -262,7 +262,7 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
                          ConstStaticArgEff(Ident.of_string "k",Int_const_eff n)
                         ] 
             in
-            let boolred_op = Eff.Predef(Predef.BoolRed,sargs) in
+            let boolred_op = Eff.PREDEF_CALL(Predef.BoolRed,sargs) in
             let arg = {
               ve_typ = [Array_type_eff(Bool_type_eff,n) ];
               ve_clk = clk;
@@ -278,7 +278,7 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
         | CallByPosEff(
             {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "nor"),_)}})}, 
             OperEff args)
-        | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.NOR_n,_)}, OperEff args) ->
+        | CallByPosEff({src=lxm_ve;it=Eff.PREDEF_CALL(Predef.NOR_n,_)}, OperEff args) ->
             (* a nor is a particular kind of boolred too:
                #(A,...,an) = boolred(0,0,n)([a1,...,an])
             *)
@@ -289,7 +289,7 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
                          ConstStaticArgEff(Ident.of_string "k",Int_const_eff n)
                         ] 
             in
-            let boolred_op = Eff.Predef(Predef.BoolRed,sargs) in
+            let boolred_op = Eff.PREDEF_CALL(Predef.BoolRed,sargs) in
             let arg = {
               ve_typ = [Array_type_eff(Bool_type_eff,n) ];
               ve_clk = clk;
@@ -306,7 +306,7 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
         | CallByPosEff({src=lxm_ve;it=CALL (
                           {it = {node_key_eff = (("Lustre", "boolred"),sargs)}})}, 
                        OperEff args)
-        | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.BoolRed,sargs)},
+        | CallByPosEff({src=lxm_ve;it=Eff.PREDEF_CALL(Predef.BoolRed,sargs)},
                        OperEff args) ->
             (* Given 
                - 3 integers i, j, k
@@ -334,11 +334,11 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
             let cpt = new_var "cpt" node_env Int_type_eff (snd res_clock) in
             let id_of_int i = Predef.ICONST_n(Ident.of_string (string_of_int i)) in
             let rhs = (* i <= cpt && cpt <= j; *)
-              let i_op = { it = Predef(id_of_int i,[]) ; src = lxm_ve }
-              and j_op = { it = Predef(id_of_int j,[]) ; src = lxm_ve }
+              let i_op = { it = PREDEF_CALL(id_of_int i,[]) ; src = lxm_ve }
+              and j_op = { it = PREDEF_CALL(id_of_int j,[]) ; src = lxm_ve }
               and cpt_op = { it = IDENT (Ident.to_idref cpt.var_name_eff);src=lxm_ve }
-              and and_op = { it = Predef(Predef.AND_n,[]) ; src = lxm_ve } 
-              and inf_op = { it = Predef(Predef.LTE_n,[]) ; src = lxm_ve } in
+              and and_op = { it = PREDEF_CALL(Predef.AND_n,[]) ; src = lxm_ve } 
+              and inf_op = { it = PREDEF_CALL(Predef.LTE_n,[]) ; src = lxm_ve } in
               let i_eff = { ve_clk=rhs_clk; ve_typ = [Int_type_eff]; ve_core = CallByPosEff(i_op, OperEff []) }
               and j_eff = { ve_clk=rhs_clk; ve_typ = [Int_type_eff]; ve_core = CallByPosEff(j_op, OperEff [])}
               and cpt_eff = { ve_clk=rhs_clk; ve_typ = [Int_type_eff]; ve_core = CallByPosEff(cpt_op, OperEff []) }
@@ -360,13 +360,13 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
                 (* (if A[0] then 1 else 0) + ... + (if A[k-1] then 1 else 0) *)
               let zero = { 
                 ve_clk = rhs_clk; ve_typ = [Int_type_eff]; 
-                ve_core = CallByPosEff({it=Predef(id_of_int 0,[]);src=lxm_ve},OperEff[])}
+                ve_core = CallByPosEff({it=PREDEF_CALL(id_of_int 0,[]);src=lxm_ve},OperEff[])}
               and one = { 
                 ve_clk = rhs_clk; 
                 ve_typ = [Int_type_eff]; 
-                ve_core = CallByPosEff({it=Predef(id_of_int 1,[]);src=lxm_ve},OperEff[]) }
-              and plus_op = { it = Predef(Predef.IPLUS_n,[]) ; src = lxm_ve } 
-              and ite_op  = { it = Predef(Predef.IF_n,[]) ;    src = lxm_ve } 
+                ve_core = CallByPosEff({it=PREDEF_CALL(id_of_int 1,[]);src=lxm_ve},OperEff[]) }
+              and plus_op = { it = PREDEF_CALL(Predef.IPLUS_n,[]) ; src = lxm_ve } 
+              and ite_op  = { it = PREDEF_CALL(Predef.IF_n,[]) ;    src = lxm_ve } 
               in
               let array, type_elt = 
                 match args with
@@ -404,7 +404,7 @@ let rec (inline_eq:  Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inl
         (* All the other operators (trying to avoid a too brutal catch-all...) *)
         | CallByPosEff
             ({it=(
-              CALL _| Predef _ |MERGE _|ARRAY_SLICE _|ARRAY_ACCES _|STRUCT_ACCESS _|ARRAY _
+              CALL _| PREDEF_CALL _ |MERGE _|ARRAY_SLICE _|ARRAY_ACCES _|STRUCT_ACCESS _|ARRAY _
               |HAT (_, _)|WITH _|WHEN _|IDENT _|CONCAT|TUPLE
               |CURRENT|FBY|ARROW|PRE)},  OperEff args) 
           -> 
diff --git a/src/licDump.ml b/src/licDump.ml
index 5e082a0d..635ab212 100644
--- a/src/licDump.ml
+++ b/src/licDump.ml
@@ -303,16 +303,16 @@ and (string_of_by_pos_op_eff: Eff.by_pos_op srcflagged -> Eff.val_exp list -> st
     in
     let str = 
       match posop.it,vel with
-        | Predef (Predef.NOT_n,_), [ve1] ->
+        | PREDEF_CALL (Predef.NOT_n,_), [ve1] ->
             ((op2string Predef.NOT_n) ^ " " ^ 
                (if is_a_tuple ve1 then (tuple_par [ve1]) else sov ve1))
               
-        | Predef (Predef.DIESE_n,_), [ve1] ->
+        | PREDEF_CALL (Predef.DIESE_n,_), [ve1] ->
             if !Global.lv4 
             then sov ve1 (* lv4 does no accept to apply # on One var only! *)
             else ((op2string Predef.DIESE_n) ^ (tuple_par [ve1]))
               
-        | Predef (Predef.IF_n,_), [ve1; ve2; ve3] ->
+        | PREDEF_CALL (Predef.IF_n,_), [ve1; ve2; ve3] ->
             let ve2str = string_of_val_exp_eff ve2 in 
             let ve2str = if is_a_tuple ve2 then "("^ve2str^")" else ve2str in
             let ve3str = string_of_val_exp_eff ve3 in 
@@ -320,7 +320,7 @@ and (string_of_by_pos_op_eff: Eff.by_pos_op srcflagged -> Eff.val_exp list -> st
               " if " ^ (string_of_val_exp_eff ve1) ^ 
                 " then " ^ ve2str ^ " else " ^ ve3str
 
-        | Predef(op,sargs), vel -> 
+        | PREDEF_CALL(op,sargs), vel -> 
             if Predef.is_infix op then (
               match vel with 
                 | [ve1; ve2] -> 
@@ -443,10 +443,10 @@ and (string_of_by_pos_op_eff: Eff.by_pos_op srcflagged -> Eff.val_exp list -> st
     in
     let do_not_parenthesize = function 
       | IDENT _,_ 
-      | Predef((Predef.ICONST_n _), _),_
-      | Predef((Predef.RCONST_n _), _),_
-      | Predef((Predef.FALSE_n), _),_
-      | Predef((Predef.TRUE_n), _),_
+      | PREDEF_CALL((Predef.ICONST_n _), _),_
+      | PREDEF_CALL((Predef.RCONST_n _), _),_
+      | PREDEF_CALL((Predef.FALSE_n), _),_
+      | PREDEF_CALL((Predef.TRUE_n), _),_
       | ARRAY_ACCES _,_
       | STRUCT_ACCESS _,_ -> true   
       | _,_ ->  false 
diff --git a/src/nodesExpand.ml b/src/nodesExpand.ml
index 89f12832..323bc78f 100644
--- a/src/nodesExpand.ml
+++ b/src/nodesExpand.ml
@@ -87,7 +87,7 @@ and (subst_in_val_exp : subst -> val_exp -> val_exp) =
                     let var = snd(List.find (fun (v,_) -> v.var_name_eff = cv) s) in
                     let cv = var.var_name_eff in
                       WHEN(SyntaxTreeCore.NamedClock  {src=lxm;it=(cc,cv)})
-                | Predef _| CALL _ | PRE | ARROW | FBY | CURRENT  | TUPLE
+                | PREDEF_CALL _| CALL _ | PRE | ARROW | FBY | CURRENT  | TUPLE
                 | CONCAT | STRUCT_ACCESS _ | ARRAY_ACCES _ | ARRAY_SLICE _  | MERGE _ 
                       (*               | CONST _ *)
                     -> by_pos_op
diff --git a/src/split.ml b/src/split.ml
index b2de7018..f9b9ab8e 100644
--- a/src/split.ml
+++ b/src/split.ml
@@ -40,7 +40,7 @@ let to_be_broken = function
   | CallByPosEff({ it = Eff.CURRENT }, _) -> true
   | CallByPosEff({ it = Eff.TUPLE }, _) -> true
   | CallByPosEff({ it = Eff.WHEN _ }, _) -> true
-  | CallByPosEff({ it = Eff.Predef(Predef.IF_n, []) }, _) -> true
+  | CallByPosEff({ it = Eff.PREDEF_CALL(Predef.IF_n, []) }, _) -> true
   | _ -> false
 
 
@@ -48,14 +48,14 @@ let (break_it : val_exp -> val_exp list) =
   fun ve -> 
     let nvel = 
       match ve.ve_core with
-	| CallByPosEff({it=Eff.Predef(Predef.IF_n,[]);src=lxm}, OperEff [c;ve1;ve2]) ->
+	| CallByPosEff({it=Eff.PREDEF_CALL(Predef.IF_n,[]);src=lxm}, OperEff [c;ve1;ve2]) ->
             let vel1 = get_vel_from_tuple ve1
             and vel2 = get_vel_from_tuple ve2 
             in
               List.map2
 		(fun ve1 ve2 -> 
 		   { ve_core = 
-                       CallByPosEff({it=Eff.Predef(Predef.IF_n,[]);src=lxm}, 
+                       CallByPosEff({it=Eff.PREDEF_CALL(Predef.IF_n,[]);src=lxm}, 
                                     OperEff [c;ve1;ve2]);
                      ve_typ = ve1.ve_typ;
                      ve_clk = ve1.ve_clk;
@@ -166,10 +166,10 @@ and (split_val_exp : bool -> bool -> node_env -> Eff.val_exp ->
     match ve.ve_core with
       | CallByPosEff({it=Eff.IDENT _}, _) -> ve, ([],[])
 
-      | CallByPosEff({src=lxm;it=Eff.Predef(Predef.TRUE_n,_)}, _) 
-      | CallByPosEff({src=lxm;it=Eff.Predef(Predef.FALSE_n,_)}, _) 
-      | CallByPosEff({src=lxm;it=Eff.Predef(Predef.ICONST_n _,_)}, _) 
-      | CallByPosEff({src=lxm;it=Eff.Predef(Predef.RCONST_n _,_)}, _) 
+      | CallByPosEff({src=lxm;it=Eff.PREDEF_CALL(Predef.TRUE_n,_)}, _) 
+      | CallByPosEff({src=lxm;it=Eff.PREDEF_CALL(Predef.FALSE_n,_)}, _) 
+      | CallByPosEff({src=lxm;it=Eff.PREDEF_CALL(Predef.ICONST_n _,_)}, _) 
+      | CallByPosEff({src=lxm;it=Eff.PREDEF_CALL(Predef.RCONST_n _,_)}, _) 
           (* We do not create an intermediary variable for those, 
              but 
           *)
diff --git a/src/structArrayExpand.ml b/src/structArrayExpand.ml
index 5498d59d..93a374c8 100644
--- a/src/structArrayExpand.ml
+++ b/src/structArrayExpand.ml
@@ -300,7 +300,7 @@ and (var_trees_of_val_exp : Eff.local_env -> Eff.id_solver -> acc -> Eff.val_exp
 			                  raise (Errors.Compile_error(lxm, msg))
             )
             | WITH(_) | HAT(_) | CONCAT | ARRAY(_) 
-            | Predef _ | CALL _  | MERGE _ 
+            | PREDEF_CALL _ | CALL _  | MERGE _ 
             | PRE | ARROW | FBY | CURRENT | WHEN _ | TUPLE -> (
                (* Create a new loc var to alias such expressions *)
                let acc, nloc = make_new_loc nenv id_solver lxm acc ve in
@@ -349,7 +349,7 @@ and (break_tuple : Lxm.t -> left list -> val_exp -> Eff.eq_info srcflagged list)
 		    ve1l 
 		    ve2l
 		    
-	  | CallByPosEff ({it= Predef(IF_n,[]); src=lxm}, OperEff [cond; ve1; ve2]) ->
+	  | CallByPosEff ({it= PREDEF_CALL(IF_n,[]); src=lxm}, OperEff [cond; ve1; ve2]) ->
               
 	      let ve1l, ve2l = aux ve1, aux ve2 in
 		if (List.length ve1l <> List.length ve2l) then
@@ -366,7 +366,7 @@ and (break_tuple : Lxm.t -> left list -> val_exp -> Eff.eq_info srcflagged list)
 		  List.map2 
 		    (fun ve1 ve2 -> 
                        { ve with ve_core = 
-                           CallByPosEff ({it= Predef(IF_n,[]); src=lxm}, 
+                           CallByPosEff ({it= PREDEF_CALL(IF_n,[]); src=lxm}, 
                                          OperEff [cond;ve1;ve2])}
                     ) 
 		    ve1l 
@@ -430,7 +430,7 @@ and (expand_val_exp: Eff.local_env -> Eff.id_solver -> acc -> val_exp ->
                   let vel,acc = expand_val_exp_list n_env id_solver acc vel in
                     TUPLE, acc, vel
 		      
-              | CONCAT | Predef _ | CALL _  | MERGE _
+              | CONCAT | PREDEF_CALL _ | CALL _  | MERGE _
               | PRE | ARROW | FBY | CURRENT | WHEN _ | TUPLE 
                   -> 
                   let vel,acc = expand_val_exp_list n_env id_solver acc vel in
diff --git a/src/unifyClock.ml b/src/unifyClock.ml
index 0d5b6a0d..75a62c0e 100644
--- a/src/unifyClock.ml
+++ b/src/unifyClock.ml
@@ -283,11 +283,11 @@ let rec (const_to_val_eff: Lxm.t -> bool -> subst -> const -> subst * val_exp) =
     let id_of_int i = Ident.of_string (string_of_int i) in
       match const with
         | Bool_const_eff b -> 
-            s, mk_by_pos_op (Predef((if b then Predef.TRUE_n else Predef.FALSE_n), [])) 
+            s, mk_by_pos_op (PREDEF_CALL((if b then Predef.TRUE_n else Predef.FALSE_n), [])) 
         | Int_const_eff  i ->
-            s, mk_by_pos_op (Predef((Predef.ICONST_n (id_of_int i)),[]))
+            s, mk_by_pos_op (PREDEF_CALL((Predef.ICONST_n (id_of_int i)),[]))
         | Real_const_eff r -> 
-            s, mk_by_pos_op (Predef((Predef.RCONST_n (Ident.of_string r)),[]))
+            s, mk_by_pos_op (PREDEF_CALL((Predef.RCONST_n (Ident.of_string r)),[]))
         | Enum_const_eff   (l, _)
         | Extern_const_eff (l, _) -> s, mk_by_pos_op (IDENT (Ident.idref_of_long l))
 
-- 
GitLab