From 5523a2875c38365d0b256cd0ed93228581a420db Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Fri, 1 Feb 2013 09:57:46 +0100
Subject: [PATCH] Change the syntax of merge (and adopt the one of heptagon).

Also, force the merge to operate over an ident rather than on any val_exp.
---
 src/ast2lic.ml                                |  9 +++---
 src/astCore.ml                                |  9 +++---
 src/astRecognizePredef.ml                     |  3 +-
 src/astV6Dump.ml                              | 10 ++-----
 src/evalClock.ml                              | 13 ++++----
 src/evalConst.ml                              |  6 ++--
 src/evalType.ml                               | 10 +++----
 src/l2lCheckLoops.ml                          |  6 ++--
 src/l2lExpandNodes.ml                         |  4 +--
 src/l2lRmPoly.ml                              |  4 +--
 src/lic.ml                                    |  4 +--
 src/licDump.ml                                |  4 +--
 src/lxm.ml                                    |  4 +--
 src/parser.mly                                | 10 +++----
 src/parserUtils.ml                            | 30 ++++++++-----------
 src/unifyClock.ml                             |  4 +--
 test/lus2lic.log.ref                          | 10 +++----
 test/lus2lic.sum                              |  2 +-
 test/should_fail/type/merge_bad_clk.lus       |  6 ++--
 test/should_fail/type/merge_bad_enum.lus      | 11 +++----
 test/should_fail/type/merge_bad_type.lus      |  6 ++--
 .../should_fail/type/merge_not_exhaustive.lus | 12 ++++----
 test/should_work/merge.lus                    |  6 ++--
 23 files changed, 86 insertions(+), 97 deletions(-)

diff --git a/src/ast2lic.ml b/src/ast2lic.ml
index 09161380..e8e7e2a8 100644
--- a/src/ast2lic.ml
+++ b/src/ast2lic.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 31/01/2013 (at 09:41) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 07:53) by Erwan Jahier> *)
 
 
 open Lxm
@@ -353,9 +353,8 @@ and (translate_val_exp : Lic.id_solver -> UnifyClock.subst -> AstCore.val_exp
   fun id_solver s ve ->
     let s, vef_core, lxm =
       match ve with
-        | MERGE_n(ve, cl) ->  
-          let lxm_ve = ve.src in
-          let s, ve = translate_val_exp id_solver s ve.it in
+        | MERGE_n(id, cl) ->  
+          let lxm_ve = id.src in
           let s, cl =
             List.fold_left
               (fun (s,cl) (id,ve) -> 
@@ -366,7 +365,7 @@ and (translate_val_exp : Lic.id_solver -> UnifyClock.subst -> AstCore.val_exp
               (s, [])
               cl
           in
-          s, Lic.Merge(flagit ve lxm_ve, List.rev cl), lxm_ve
+          s, Lic.Merge(id, List.rev cl), lxm_ve
         | CallByName(by_name_op, field_list) ->
           let s,fl = List.fold_left 
             (fun (s,fl) f -> 
diff --git a/src/astCore.ml b/src/astCore.ml
index ba0fefab..58e2d34f 100644
--- a/src/astCore.ml
+++ b/src/astCore.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 30/01/2013 (at 17:43) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 07:53) by Erwan Jahier> *)
 
 
 (** (Raw) Abstract syntax tree of source Lustre Core programs. *)
@@ -107,9 +107,7 @@ and by_pos_op =
   | STRUCT_ACCESS_n of Ident.t
 
   | ARRAY_ACCES_n of val_exp
-  | ARRAY_SLICE_n of slice_info
-(*   | MERGE_n of (Ident.t * ((Ident.t srcflagged * val_exp) list)) *)
-   
+  | ARRAY_SLICE_n of slice_info   
 
 (************************************************)
 (* Info associées aux expressions               *)
@@ -126,7 +124,7 @@ and by_pos_op =
 and val_exp = 
   | CallByPos  of (by_pos_op  srcflagged  * operands) 
   | CallByName of (by_name_op srcflagged  * (Ident.t srcflagged * val_exp) list)
-  | MERGE_n of val_exp srcflagged * (Ident.idref srcflagged * val_exp) list
+  | MERGE_n of Ident.t srcflagged * (Ident.idref srcflagged * val_exp) list
    
 and operands = Oper of val_exp list
 (* Virer cet Oper ? Non, sinon ca boucle... *)
@@ -212,3 +210,4 @@ let string_of_var_nature = function
 let lxm_of_val_exp = function
   | CallByPos(op,_)  -> op.src
   | CallByName(op,_) -> op.src
+  | MERGE_n(id,_) -> id.src
diff --git a/src/astRecognizePredef.ml b/src/astRecognizePredef.ml
index a9d64294..2fef1dca 100644
--- a/src/astRecognizePredef.ml
+++ b/src/astRecognizePredef.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 30/01/2013 (at 17:51) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 07:54) by Erwan Jahier> *)
 
 
 let (get_predef : Ident.idref -> AstPredef.op option) =
@@ -115,7 +115,6 @@ and r_val_exp = function
   | CallByName(by_name_op, args) -> 
     CallByName(by_name_op, List.map (fun (id, ve) -> id, r_val_exp ve) args)
   | MERGE_n (ec,cl) -> 
-    let ec = flagit (r_val_exp ec.it) ec.src in
     let cl = List.map (fun (id,ve) ->  (id, r_val_exp ve)) cl in
     MERGE_n (ec,cl) 
 
diff --git a/src/astV6Dump.ml b/src/astV6Dump.ml
index bcac4623..9b726c3d 100644
--- a/src/astV6Dump.ml
+++ b/src/astV6Dump.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 30/01/2013 (at 17:46) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 07:59) by Erwan Jahier> *)
 
 
 open Lxm
@@ -34,7 +34,6 @@ let rec (op2string : AstCore.by_pos_op -> string) =
       | (ARRAY_ACCES_n _ ) ->  assert false
       | (ARRAY_SLICE_n sl) -> assert false
       | (STRUCT_ACCESS_n fld) -> assert false
-(*     | (MERGE_n _) -> assert false *)
 
 
 (***********************************************************************************)
@@ -357,8 +356,8 @@ and dump_val_exp (os: Format.formatter) (x: val_exp) = (
   match x with
     | CallByPos ( {it=oper; src=lxm} , pars ) -> dump_by_pos_exp os oper pars
     | CallByName ({it=oper; src=lxm},nm_pars) -> dump_by_name_exp os oper nm_pars
-    | MERGE_n (ve, _) -> (* finish me *)
-        fprintf os "merge %a (...) "  dump_val_exp ve.it
+    | MERGE_n (id, _) -> (* finish me *)
+        fprintf os "merge %s (...) "  (Ident.to_string id.it)
 )
 and dump_val_exp_list (os : formatter) (xl: val_exp list) = (
   match xl with 
@@ -436,9 +435,6 @@ and dump_by_pos_exp (os: Format.formatter) (oper: by_pos_op) (pars: operands) =
       | (STRUCT_ACCESS_n fld, Oper [p0]) -> fprintf os "%a.%s"
 	     dump_val_exp p0 (Ident.to_string fld)
 
-      (*       | (ITERATOR_n _, _) -> assert false *)
-      (*       | (MERGE_n _,_) -> assert false *)
-
       | (FBY_n, _) -> assert false
 
       | (STRUCT_ACCESS_n _, _) -> assert false
diff --git a/src/evalClock.ml b/src/evalClock.ml
index 4afe893f..a53078c2 100644
--- a/src/evalClock.ml
+++ b/src/evalClock.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 31/01/2013 (at 17:50) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 08:39) by Erwan Jahier> *)
  
   
 open AstPredef
@@ -210,17 +210,20 @@ and f_aux id_solver s ve =
           raise (Compile_error(lxm, "\n*** can't eval constant: "^msg))
       )
       | Merge(ce, cl) -> 
-        let _ve,cel,s = f ce.src id_solver s ce.it [] in
-        let ce_id, (merge_clk:Lic.clock) = match cel with [c] -> c | _ -> assert false in
+        let _, (merge_clk : Lic.clock) = 
+          var_info_eff_to_clock_eff (UglyStuff.var_info_of_ident id_solver ce.it ce.src) 
+        in
+        
+(*         let ce_id, (merge_clk:Lic.clock) = match cel with [c] -> c | _ -> assert false in *)
         let check_case s (id,ve) =
         (* Check that ve is on id(ce) on merge_clk *)
-          let id_clk : Ident.clk = (Ident.idref_of_long id.it, ce_id) in
+          let id_clk : Ident.clk = (Ident.idref_of_long id.it, ce.it) in
           let exp_clk = [On(id_clk, merge_clk)] in
           let _ve,cel,s = f id.src id_solver s ve exp_clk in
           s
         in
         let s = List.fold_left check_case s cl in
-        (cel,s), ce.src
+        ([ce.it,merge_clk],s), ce.src
   in
   let new_clk = snd (List.split cel) in
   let s, ve = 
diff --git a/src/evalConst.ml b/src/evalConst.ml
index 8048239c..6e820231 100644
--- a/src/evalConst.ml
+++ b/src/evalConst.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 30/01/2013 (at 18:09) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 07:57) by Erwan Jahier> *)
 
 
 open Printf 
@@ -89,8 +89,6 @@ let (make_array_const : Lic.const list list -> Lic.const) =
       | None -> raise (EvalConst_error("empty array"))
       | Some t -> Array_const_eff(res, t)
 
-
-
 (** Utilitaire : fabriquer si possible une constante structure 
 
 N.B. Par construction on sait que nops n'a pas de doublons
@@ -177,7 +175,7 @@ let rec f
     -> capte les nv
     -> récupère les EvalConst_error 
     -----------------------------------*)
-  let rec rec_eval_const (vexp : AstCore.val_exp) = (
+  let rec rec_eval_const (vexp : AstCore.val_exp) : Lic.const list = (
     match vexp with
       | AstCore.CallByPos ({it=posop; src=lxm}, Oper args) -> (
         try eval_by_pos_const posop lxm args
diff --git a/src/evalType.ml b/src/evalType.ml
index 8c4751b7..e1352e68 100644
--- a/src/evalType.ml
+++ b/src/evalType.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 31/01/2013 (at 09:39) by Erwan Jahier> *)
+(** Time-stamp: <modified the 01/02/2013 (at 08:36) by Erwan Jahier> *)
  
   
 open AstPredef
@@ -318,10 +318,10 @@ and eval_by_name_type (id_solver:  Lic.id_solver) (namop: Lic.by_name_op) (lxm:
           in (namargs, [struct_type])
         | _ -> raise (Compile_error(lxm, "type error: a structure is expected"))
 
-and (eval_merge : Lic.id_solver -> Lic.val_exp -> Lxm.t -> 
+and (eval_merge : Lic.id_solver -> Ident.t -> Lxm.t -> 
      (Ident.long Lxm.srcflagged * Lic.val_exp) list -> Lic.val_exp_core * Lic.type_ list) =
   fun id_solver clk lxm nargs -> 
-    let clk, tclk = f id_solver clk in
+    let tclk = (UglyStuff.var_info_of_ident id_solver clk lxm).var_type_eff in
     let nargs,tl_opt = 
       List.fold_left
         (fun (acc,tl_opt) (id,ve) ->
@@ -330,9 +330,9 @@ and (eval_merge : Lic.id_solver -> Lic.val_exp -> Lxm.t ->
             let c = id_solver.id2const (Ident.idref_of_long id.it) id.src in
             type_of_const c
           in
-          if [id_type] <> tclk then (
+          if id_type <> tclk then (
             let msg = "type error in a merge branch: " ^
-              (Lic.string_of_type (List.hd tclk)) ^ " was expected, but " ^
+              (Lic.string_of_type tclk) ^ " was expected, but " ^
               (Lic.string_of_type id_type) ^ " was provided. " 
             in
             raise (Compile_error(lxm, "type error: "^msg))
diff --git a/src/l2lCheckLoops.ml b/src/l2lCheckLoops.ml
index 8867e468..fd13a2fb 100644
--- a/src/l2lCheckLoops.ml
+++ b/src/l2lCheckLoops.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 31/01/2013 (at 09:37) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 08:42) by Erwan Jahier> *)
 
 open Lxm
 open Errors
@@ -25,8 +25,8 @@ and
         let s = vars_of_by_pos_op s by_pos_op.it in
         List.fold_left vars_of_exp s vel
       | Merge(ce, l) -> 
-        let s = vars_of_exp s ce.it in
-        List.fold_left (fun s (_,ve) -> vars_of_exp s ce.it) s l
+        let s = IdSet.add ce.it s in
+        List.fold_left (fun s (_,ve) -> vars_of_exp s ve) s l
       | CallByNameLic(_, _) -> s
 and 
     vars_of_by_pos_op s = function
diff --git a/src/l2lExpandNodes.ml b/src/l2lExpandNodes.ml
index ab2ae431..08b21f30 100644
--- a/src/l2lExpandNodes.ml
+++ b/src/l2lExpandNodes.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 31/01/2013 (at 09:39) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 08:42) by Erwan Jahier> *)
 
 
 open Lxm
@@ -104,7 +104,7 @@ and (subst_in_val_exp : subst -> val_exp -> val_exp) =
             CallByNameLic(by_name_op, fl) 
           | Merge(ce,cl) ->
             let cl = List.map (fun (id,ve) -> (id, subst_in_val_exp s ve)) cl in
-            Merge(flagit (subst_in_val_exp s ce.it) ce.src,cl)
+            Merge(ce, cl)
     }
     in
     newve
diff --git a/src/l2lRmPoly.ml b/src/l2lRmPoly.ml
index 0a25fddb..7fb5a9d3 100644
--- a/src/l2lRmPoly.ml
+++ b/src/l2lRmPoly.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 31/01/2013 (at 09:38) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 08:43) by Erwan Jahier> *)
 
 (*
 Source 2 source transformation :
@@ -126,7 +126,7 @@ let rec doit (inprg : LicPrg.t) : LicPrg.t =
           CallByNameLic (namop, idops')
         | Merge (ce,cl) -> 
           let cl = List.map (fun (id, ve) -> (id, (do_exp m) ve)) cl in
-          Merge (flagit (do_exp m ce.it) ce.src, cl)
+          Merge (ce, cl)
       in
       { e with ve_core = core'; ve_typ = typ' }
   (* TRAITEMENT DES PARAMS STATIQUES *)
diff --git a/src/lic.ml b/src/lic.ml
index fd7457e8..d978ff3d 100644
--- a/src/lic.ml
+++ b/src/lic.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 31/01/2013 (at 10:14) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 08:22) by Erwan Jahier> *)
 
 (** Define the Data Structure representing Compiled programs. *)
 
@@ -190,7 +190,7 @@ and val_exp_core =
   | CallByPosLic  of (by_pos_op srcflagged * operands)
   | CallByNameLic of
       (by_name_op srcflagged * (Ident.t srcflagged * val_exp) list)
-  | Merge of val_exp srcflagged * (Ident.long srcflagged * val_exp) list
+  | Merge of Ident.t srcflagged * (Ident.long srcflagged * val_exp) list
 
 and operands = OperLic of val_exp list
 
diff --git a/src/licDump.ml b/src/licDump.ml
index 50908c20..6d8282cc 100644
--- a/src/licDump.ml
+++ b/src/licDump.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 31/01/2013 (at 10:27) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 08:27) by Erwan Jahier> *)
 
 open Errors
 open Printf
@@ -437,7 +437,7 @@ and string_of_val_exp_eff_core ve_core =
       (string_of_by_pos_op_eff by_pos_op_eff vel) 
 
     | Merge (ve, cl) -> (
-      "merge " ^ (string_of_val_exp_eff ve.it) ^ " " ^
+      "merge " ^ (Ident.to_string ve.it) ^ " " ^
         (String.concat " " 
            (List.map 
               (fun (id,ve) -> "| "^(dump_long id.it) ^ " => " ^ (string_of_val_exp_eff ve)^" ")
diff --git a/src/lxm.ml b/src/lxm.ml
index 03e4d940..dc54a148 100644
--- a/src/lxm.ml
+++ b/src/lxm.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 29/01/2013 (at 17:37) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 09:57) by Erwan Jahier> *)
 
 (** Common to lus2lic and lic2loc  *)
 
@@ -72,7 +72,7 @@ let last_lexeme = ref (dummy "")
 let make ( lexbuf ) = (
   let s = (Lexing.lexeme lexbuf) in
   let l = !Global.line_num in
-  let c1 = (Lexing.lexeme_start lexbuf - !Global.line_start_pos + 1) in
+  let c1 = (Lexing.lexeme_start lexbuf - !Global.line_start_pos+1) in
   let c2 = (Lexing.lexeme_end lexbuf - !Global.line_start_pos) in
     last_lexeme := 
       { _str = s ; 
diff --git a/src/parser.mly b/src/parser.mly
index dfd0bc56..48c1afb4 100644
--- a/src/parser.mly
+++ b/src/parser.mly
@@ -823,8 +823,8 @@ Expression:
         |  TK_OPEN_PAR ExpressionList TK_CLOSE_PAR
 				{ if (List.length $2 = 1) then (List.hd $2) else naryexp $1 TUPLE_n (List.rev $2) }
         /* merge */
-        |  TK_MERGE Expression MergeCaseList
-                        { make_merge_op $1 $2 $3 }
+        |  TK_MERGE Ident MergeCaseList
+                { make_merge_op $2 $3 }
         ;
 
 MergeCaseList:
@@ -835,10 +835,8 @@ MergeCaseList:
         ;
 
 MergeCase:
-          TK_BAR IdentRef TK_ARROW Expression 
-            { ($2,$4) }
-        |  TK_BAR IdentRef TK_IMPL Expression 
-            { ($2,$4) }
+        |  TK_OPEN_PAR IdentRef TK_ARROW Expression TK_CLOSE_PAR
+           { ($2,$4) }
         ;
 
 ClockExpr:
diff --git a/src/parserUtils.ml b/src/parserUtils.ml
index 633ba005..b7be8ada 100644
--- a/src/parserUtils.ml
+++ b/src/parserUtils.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 30/01/2013 (at 18:05) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 08:05) by Erwan Jahier> *)
 
 (** *)
 
@@ -117,16 +117,21 @@ let flat_twice_flagged_list
     )
 
 (**********************************************************************************)
+(** Traitement des listes d'idents avec valeur éventuelle
+    (constantes, champs de struct etc...)
+*)
+
+let (lexeme_to_ident_flagged: Lxm.t -> Ident.t Lxm.srcflagged) = 
+  fun x -> {it = (Lxm.id x); src = x }
+
+let (lexeme_to_pack_name_flagged:Lxm.t -> Ident.pack_name  Lxm.srcflagged) = 
+  fun x -> {it = (Ident.pack_name_of_string (Lxm.str x)); src = x }
 
-(** Utilitaries to build [val_exp]  *)
-(* let make_merge_op lxm (v:val_exp) (l:(Lxm.t * val_exp) list)  =  *)
-(*   let l = List.map (fun (lxm,ve) -> { it=Lxm.str lxm ; src = lxm },ve) l in *)
-(*    CallByPos( { src = lxm ; it = MERGE_n (v,l) }, Oper [] ) *)
 
-let make_merge_op lxm (enum_clk:val_exp) (l:(Ident.idref srcflagged * val_exp) list)  = 
+(** Utilitaries to build [val_exp]  *)
+let make_merge_op (enum_clk:Lxm.t) (l:(Ident.idref srcflagged * val_exp) list)  = 
   let l = List.map (fun (idref,ve) -> idref,ve) l in
-  let enum_clk =  { src = lxm ; it = enum_clk } in
-  MERGE_n(enum_clk,l) 
+  MERGE_n(lexeme_to_ident_flagged enum_clk, l) 
 
 let make_predef_posop lxm op =
    let op = flagit op lxm in
@@ -233,15 +238,6 @@ let (def_list : item_ident list ref) = ref []
 
   
 (**********************************************************************************)
-(** Traitement des listes d'idents avec valeur éventuelle
-    (constantes, champs de struct etc...)
-*)
-
-let (lexeme_to_ident_flagged: Lxm.t -> Ident.t Lxm.srcflagged) = 
-  fun x -> {it = (Lxm.id x); src = x }
-
-let (lexeme_to_pack_name_flagged:Lxm.t -> Ident.pack_name  Lxm.srcflagged) = 
-  fun x -> {it = (Ident.pack_name_of_string (Lxm.str x)); src = x }
 
 
 (* Listes d'idents typés et (éventuellement) valués *)
diff --git a/src/unifyClock.ml b/src/unifyClock.ml
index d6784f87..3a92f536 100644
--- a/src/unifyClock.ml
+++ b/src/unifyClock.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 31/01/2013 (at 09:38) by Erwan Jahier> *)
+(* Time-stamp: <modified the 01/02/2013 (at 08:28) by Erwan Jahier> *)
 
 
 open LicDump
@@ -205,7 +205,7 @@ let rec (apply_subst_val_exp : subst -> Lic.val_exp -> Lic.val_exp) =
           let cl = List.map
             (fun (fn,ve) -> (fn, apply_subst_val_exp s ve)) cl
           in
-          Merge(flagit (apply_subst_val_exp s ce.it) ce.src, cl) 
+          Merge(ce, cl) 
     in
     let new_clk = List.map (apply_subst s) ve.ve_clk in
     let ve = { ve with ve_core = ve_core ; ve_clk = new_clk } in
diff --git a/test/lus2lic.log.ref b/test/lus2lic.log.ref
index 737c551d..7a9be711 100644
--- a/test/lus2lic.log.ref
+++ b/test/lus2lic.log.ref
@@ -1,4 +1,4 @@
-Test Run By jahier on Thu Jan 31 17:42:30 2013
+Test Run By jahier on Fri Feb  1 09:44:41 2013
 Native configuration is i686-pc-linux-gnu
 
 		=== lus2lic tests ===
@@ -1500,7 +1500,7 @@ spawn ./lus2lic -o /tmp/parametric_node.lic should_fail/type/parametric_node.lus
 
 XFAIL: Test bad programs (type): lus2lic {-o /tmp/parametric_node.lic should_fail/type/parametric_node.lus}
 spawn ./lus2lic -o /tmp/merge_bad_enum.lic should_fail/type/merge_bad_enum.lus
-*** Error in file "/home/jahier/lus2lic/test/should_fail/type/merge_bad_enum.lus", line 8, col 9 to 13, token 'merge':
+*** Error in file "/home/jahier/lus2lic/test/should_fail/type/merge_bad_enum.lus", line 9, col 15 to 17, token 'clk':
 *** type error: type error in a merge branch: merge_bad_enum::trival was expected, but merge_bad_enum::okko was provided. 
 
 XFAIL: Test bad programs (type): lus2lic {-o /tmp/merge_bad_enum.lic should_fail/type/merge_bad_enum.lus}
@@ -1512,7 +1512,7 @@ spawn ./lus2lic -o /tmp/condact2.lic should_fail/type/condact2.lus
 
 XFAIL: Test bad programs (type): lus2lic {-o /tmp/condact2.lic should_fail/type/condact2.lus}
 spawn ./lus2lic -o /tmp/merge_bad_type.lic should_fail/type/merge_bad_type.lus
-*** Error in file "/home/jahier/lus2lic/test/should_fail/type/merge_bad_type.lus", line 8, col 9 to 13, token 'merge':
+*** Error in file "/home/jahier/lus2lic/test/should_fail/type/merge_bad_type.lus", line 8, col 15 to 17, token 'clk':
 *** type error: types differ in merge branches: real <> int
 
 XFAIL: Test bad programs (type): lus2lic {-o /tmp/merge_bad_type.lic should_fail/type/merge_bad_type.lus}
@@ -1539,7 +1539,7 @@ spawn ./lus2lic -o /tmp/Gyro-2.lic should_fail/type/Gyro-2.lus
 
 XFAIL: Test bad programs (type): lus2lic {-o /tmp/Gyro-2.lic should_fail/type/Gyro-2.lus}
 spawn ./lus2lic -o /tmp/merge_bad_clk.lic should_fail/type/merge_bad_clk.lus
-*** Error in file "/home/jahier/lus2lic/test/should_fail/type/merge_bad_clk.lus", line 9, col 11 to 14, token 'Pile':
+*** Error in file "/home/jahier/lus2lic/test/should_fail/type/merge_bad_clk.lus", line 9, col 10 to 13, token 'Pile':
 *** 
 *** clock error: The two following clocks are not unifiable:
 ***	 on merge_bad_clk::Pile(clk) on base
@@ -1810,4 +1810,4 @@ testcase ./lus2lic.tests/progression.exp completed in 0 seconds
 # of unexpected successes	11
 # of expected failures		36
 # of unresolved testcases	2
-runtest completed at Thu Jan 31 17:43:24 2013
+runtest completed at Fri Feb  1 09:45:35 2013
diff --git a/test/lus2lic.sum b/test/lus2lic.sum
index f3f1c95c..abdea99e 100644
--- a/test/lus2lic.sum
+++ b/test/lus2lic.sum
@@ -1,4 +1,4 @@
-Test Run By jahier on Thu Jan 31 17:42:30 2013
+Test Run By jahier on Fri Feb  1 09:52:00 2013
 Native configuration is i686-pc-linux-gnu
 
 		=== lus2lic tests ===
diff --git a/test/should_fail/type/merge_bad_clk.lus b/test/should_fail/type/merge_bad_clk.lus
index 68a53dfa..4225ecf6 100644
--- a/test/should_fail/type/merge_bad_clk.lus
+++ b/test/should_fail/type/merge_bad_clk.lus
@@ -6,7 +6,7 @@ node merge_node(clk: trival; ---
 returns (y: int); ---
 let
     y = merge clk
-        | Pile ->    i2 -- bad clock !!
-        | Face ->    i1 -- bad clock !!
-        | Tranche -> i3;
+        (Pile ->    i2) -- bad clock !!
+        (Face ->    i1) -- bad clock !!
+        (Tranche -> i3);
 tel
\ No newline at end of file
diff --git a/test/should_fail/type/merge_bad_enum.lus b/test/should_fail/type/merge_bad_enum.lus
index 2914b40a..e0e9623b 100644
--- a/test/should_fail/type/merge_bad_enum.lus
+++ b/test/should_fail/type/merge_bad_enum.lus
@@ -1,12 +1,13 @@
 type trival = enum { Pile, Face, Tranche }; ---
 type okko = enum { Ok,ko }; ---
 node merge_node(clk: trival; ---
-   i1 : int when Pile(clk) ; i2 :  int when Face(clk); 
-   i3:  int when Tranche(clk)) 
+   i1 : int when Pile(clk) ; 
+   i2 : int when Face(clk); 
+   i3 : int when Tranche(clk)) 
 returns (y: int); ---
 let
     y = merge clk
-        | Pile ->  i1
-        | Ok ->    i2
-        | Tranche -> i3;
+        (Pile ->  i1)
+        (Ok ->    i2)
+        (Tranche -> i3);
 tel
\ No newline at end of file
diff --git a/test/should_fail/type/merge_bad_type.lus b/test/should_fail/type/merge_bad_type.lus
index df742239..ccb45908 100644
--- a/test/should_fail/type/merge_bad_type.lus
+++ b/test/should_fail/type/merge_bad_type.lus
@@ -6,7 +6,7 @@ node merge_node(clk: trival; ---
 returns (y: int); ---
 let
     y = merge clk
-        | Pile ->  i1
-        | Face ->    i2
-        | Tranche -> i3;
+        (Pile ->  i1)
+        (Face ->    i2)
+        (Tranche -> i3);
 tel
\ No newline at end of file
diff --git a/test/should_fail/type/merge_not_exhaustive.lus b/test/should_fail/type/merge_not_exhaustive.lus
index 631aad46..554ba4b8 100644
--- a/test/should_fail/type/merge_not_exhaustive.lus
+++ b/test/should_fail/type/merge_not_exhaustive.lus
@@ -1,12 +1,12 @@
 type trival = enum { Pile, Face, Tranche }; ---
 node merge_node(clk: trival; ---
-   i1 : int when Pile(clk) ; i2 :  int when Face(clk); 
-   i3:  int when Tranche(clk)) 
+   i1 : int when Pile(clk) ;
+   i2 : int when Face(clk); 
+   i3 : int when Tranche(clk)) 
 returns (y: int); ---
 let
     y = merge clk
-
---       | Pile ->    i1
-        | Face    -> i2
-        | Tranche -> i3;
+--      (Pile ->    i1)
+        (Face    -> i2)
+        (Tranche -> i3);
 tel
\ No newline at end of file
diff --git a/test/should_work/merge.lus b/test/should_work/merge.lus
index 0cf0136c..c65af55b 100644
--- a/test/should_work/merge.lus
+++ b/test/should_work/merge.lus
@@ -6,7 +6,7 @@ node merge_node(clk: trival; ---
 returns (y: int); ---
 let
     y = merge clk
-        | Pile    => (0->i1)
-        | Face    => i2
-        | Tranche => i3;
+        ( Pile    -> 0->i1)
+        ( Face    -> i2)
+        ( Tranche -> i3);
 tel
\ No newline at end of file
-- 
GitLab