From 0c5ec5b79f10fbd98081e317fb7cd8a1ba568cb4 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Thu, 16 May 2013 13:51:07 +0200
Subject: [PATCH] Force user to write Lustre::lt instead of lt to avoid name
 clashes.

---
 src/astRecognizePredef.ml    |  5 ++--
 src/l2lRmPoly.ml             |  4 ++--
 src/lic2soc.ml               |  4 ++--
 src/licTab.ml                | 44 ++++++++++++++++--------------------
 src/unifyType.ml             |  9 +++++---
 test/lus2lic.sum             | 12 ++++------
 test/should_work/mapinf.lus  |  2 +-
 test/should_work/matrice.lus |  2 +-
 test/should_work/ply01.lus   |  4 ++--
 test/should_work/yyy.lus     |  3 ++-
 todo.org                     |  8 -------
 todo.org_archive             | 24 ++++++++++++++++++++
 12 files changed, 68 insertions(+), 53 deletions(-)

diff --git a/src/astRecognizePredef.ml b/src/astRecognizePredef.ml
index 9f2700a7..320ce70b 100644
--- a/src/astRecognizePredef.ml
+++ b/src/astRecognizePredef.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 06/02/2013 (at 17:00) by Erwan Jahier> *)
+(* Time-stamp: <modified the 16/05/2013 (at 17:39) by Erwan Jahier> *)
 
 
 let (get_predef : Ident.idref -> AstPredef.op option) =
@@ -8,7 +8,8 @@ let (get_predef : Ident.idref -> AstPredef.op option) =
       with Not_found -> None
     in
     match Ident.pack_of_idref idref with
-      | None -> get_op () (* The Lustre package is «use»d by default *) 
+      | None -> None
+(*         get_op () (* The Lustre package is «use»d by default *)  *)
       | Some p -> if (Ident.pack_name_to_string p) = "Lustre" then get_op () else None
 
 open AstV6
diff --git a/src/l2lRmPoly.ml b/src/l2lRmPoly.ml
index b0bcb09f..5ef09e22 100644
--- a/src/l2lRmPoly.ml
+++ b/src/l2lRmPoly.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 11/04/2013 (at 17:33) by Erwan Jahier> *)
+(* Time-stamp: <modified the 16/05/2013 (at 10:27) by Erwan Jahier> *)
 
 (*
 Source 2 source transformation :
@@ -48,7 +48,7 @@ let rec doit (inprg : LicPrg.t) : LicPrg.t =
   let rec do_node k (ne:Lic.node_exp) = (
     if node_is_poly ne then
       (* pour les noeuds polymorphes/surchagés, on fait rien du tout *)
-      Verbose.exe (fun() -> Printf.printf
+      Verbose.exe ~flag:dbg (fun() -> Printf.printf
         "### Warning: no code generated for polymorphic/overloaded node '%s'\n"
         (Lic.string_of_node_key ne.node_key_eff))
     else
diff --git a/src/lic2soc.ml b/src/lic2soc.ml
index c0f48d4a..9e33e499 100644
--- a/src/lic2soc.ml
+++ b/src/lic2soc.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 07/05/2013 (at 17:08) by Erwan Jahier> *)
+(** Time-stamp: <modified the 16/05/2013 (at 09:15) by Erwan Jahier> *)
  
 open Lxm
 open Lic
@@ -639,7 +639,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) =
           match LicPrg.find_node prog nk with
             | None  -> 
               prerr_string (
-                "*** "^ (LicDump.string_of_node_key_rec false nk) ^" not defined.\n" ^
+                "*** "^ (LicDump.string_of_node_key_rec false nk) ^" not defined (as lic).\n" ^
                   "*** Defined nodes are:"^ 
                   (String.concat ",\n"  
                      (List.map (fun (nk,_) -> "\""^LicDump.string_of_node_key_rec false nk^"\"")
diff --git a/src/licTab.ml b/src/licTab.ml
index d85298fe..4756e527 100644
--- a/src/licTab.ml
+++ b/src/licTab.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 24/04/2013 (at 17:43) by Erwan Jahier> *)
+(* Time-stamp: <modified the 16/05/2013 (at 11:05) by Erwan Jahier> *)
 
 
 open Lxm
@@ -56,24 +56,24 @@ let (create : AstTab.t -> t) =
       (* Iterated operators need to be in this table. Ideally, the lazy
          compiler should be able to pull such strings though...
       *)
-      List.iter
-        (fun op -> 
-           let op_str = AstPredef.op2string op in
-           let op_eff = LicEvalType.make_simple_node_exp_eff None op (Lxm.dummy op_str) in
-           let op_key = AstPredef.op_to_long op, [] in
-             Hashtbl.add nodes_tbl op_key (Lic.Checked op_eff);
-             Hashtbl.add prov_nodes_tbl op_key (Lic.Checked op_eff)
-        )
-        AstPredef.iterable_op;
-      {
-        src_tab = tbl;
-        types = Hashtbl.create 0;
-        consts =  Hashtbl.create 0;
-        nodes  = nodes_tbl;
-        prov_types = Hashtbl.create 0;
-        prov_consts =  Hashtbl.create 0;
-        prov_nodes  = prov_nodes_tbl;
-      } 
+    List.iter
+      (fun op -> 
+        let op_str = AstPredef.op2string op in
+        let op_eff = LicEvalType.make_simple_node_exp_eff None op (Lxm.dummy op_str) in
+        let op_key = AstPredef.op_to_long op, [] in
+        Hashtbl.add nodes_tbl op_key (Lic.Checked op_eff);
+        Hashtbl.add prov_nodes_tbl op_key (Lic.Checked op_eff)
+      )
+      AstPredef.iterable_op;
+    {
+      src_tab = tbl;
+      types = Hashtbl.create 0;
+      consts =  Hashtbl.create 0;
+      nodes  = nodes_tbl;
+      prov_types = Hashtbl.create 0;
+      prov_consts =  Hashtbl.create 0;
+      prov_nodes  = prov_nodes_tbl;
+    } 
 
 (******************************************************************************)
 
@@ -270,11 +270,7 @@ let lookup_node_exp_eff
       raise Not_found
    )
 
-let node_builtin
-   (this: t)
-   (key: Lic.node_key)
-   (lxm: Lxm.t)
-: Lic.node_exp = 
+let node_builtin (this: t) (key: Lic.node_key) (lxm: Lxm.t) : Lic.node_exp = 
    (* 12/07 *)
    (* ICI => courtcircuite les macros built-in *)
    let nk2nd = fun nk ->
diff --git a/src/unifyType.ml b/src/unifyType.ml
index e041e773..53bca868 100644
--- a/src/unifyType.ml
+++ b/src/unifyType.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 11/04/2013 (at 17:31) by Erwan Jahier> *)
+(* Time-stamp: <modified the 17/05/2013 (at 10:56) by Erwan Jahier> *)
 
 (*
 12/07. Premier pas vers une méthode un peu plus standard :
@@ -103,14 +103,17 @@ let f (l1: Lic.type_ list) (l2: Lic.type_ list): t =
        Ko("\n***    " ^ (teff2str t1) ^ " and " ^ (teff2str t2) ^
        " are not unifiable")
   in
+   Verbose.printf ~flag:dbg
+      "#DBG: UnifyType.f (%s) with (%s) \n"
+      (Lic.string_of_type_list l1)
+      (Lic.string_of_type_list l2);
    assert (List.length l1 = List.length l2);
    let res = List.fold_left2 unify_do_acc Equal l1 l2 in
    Verbose.printf ~flag:dbg
       "#DBG: UnifyType.f (%s) with (%s) gives %s\n"
       (Lic.string_of_type_list l1)
       (Lic.string_of_type_list l2)
-      (string_of_t res)
-   ;
+      (string_of_t res);
    res
 
 (****** MATCH ASSYMETRIQUE
diff --git a/test/lus2lic.sum b/test/lus2lic.sum
index 745893f5..4719f6d5 100644
--- a/test/lus2lic.sum
+++ b/test/lus2lic.sum
@@ -1,4 +1,4 @@
-Test Run By jahier on Wed May 15 16:55:23 2013
+Test Run By jahier on Fri May 17 11:06:34 2013
 Native configuration is i686-pc-linux-gnu
 
 		=== lus2lic tests ===
@@ -147,7 +147,6 @@ PASS: ./ec2c {-o /tmp/predefOp.c /tmp/predefOp.ec}
 FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/predefOp.lus
 FAIL: without any option: ./lus2lic {-o /tmp/t1.lic should_work/t1.lus}
 FAIL: Generate ec code  : ./lus2lic {-ec -o /tmp/t1.ec should_work/t1.lus}
-FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/t1.lus
 PASS: ./lus2lic {-o /tmp/nc9.lic should_work/nc9.lus}
 PASS: ./lus2lic {-ec -o /tmp/nc9.ec should_work/nc9.lus}
 PASS: ./ec2c {-o /tmp/nc9.c /tmp/nc9.ec}
@@ -412,7 +411,7 @@ PASS: ../utils/test_lus2lic_no_node should_work/produitBool.lus
 PASS: ./lus2lic {-o /tmp/noeudsIndependants.lic should_work/noeudsIndependants.lus}
 PASS: ./lus2lic {-ec -o /tmp/noeudsIndependants.ec should_work/noeudsIndependants.lus}
 PASS: ./ec2c {-o /tmp/noeudsIndependants.c /tmp/noeudsIndependants.ec}
-FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/noeudsIndependants.lus
+PASS: ../utils/test_lus2lic_no_node should_work/noeudsIndependants.lus
 PASS: ./lus2lic {-o /tmp/mouse.lic should_work/mouse.lus}
 PASS: ./lus2lic {-ec -o /tmp/mouse.ec should_work/mouse.lus}
 PASS: ./ec2c {-o /tmp/mouse.c /tmp/mouse.ec}
@@ -513,7 +512,6 @@ PASS: ../utils/test_lus2lic_no_node should_work/carV2.lus
 PASS: ./lus2lic {-o /tmp/test_merge.lic should_work/test_merge.lus}
 PASS: ./lus2lic {-ec -o /tmp/test_merge.ec should_work/test_merge.lus}
 FAIL: Try ec2c on the result: ./ec2c {-o /tmp/test_merge.c /tmp/test_merge.ec}
-FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/test_merge.lus
 PASS: ./lus2lic {-o /tmp/FillFollowedByRed.lic should_work/FillFollowedByRed.lus}
 PASS: ./lus2lic {-ec -o /tmp/FillFollowedByRed.ec should_work/FillFollowedByRed.lus}
 PASS: ./ec2c {-o /tmp/FillFollowedByRed.c /tmp/FillFollowedByRed.ec}
@@ -607,7 +605,7 @@ FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node shou
 PASS: ./lus2lic {-o /tmp/ply01.lic should_work/ply01.lus}
 PASS: ./lus2lic {-ec -o /tmp/ply01.ec should_work/ply01.lus}
 PASS: ./ec2c {-o /tmp/ply01.c /tmp/ply01.ec}
-FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/ply01.lus
+PASS: ../utils/test_lus2lic_no_node should_work/ply01.lus
 PASS: ./lus2lic {-o /tmp/consensus.lic should_work/consensus.lus}
 PASS: ./lus2lic {-ec -o /tmp/consensus.ec should_work/consensus.lus}
 PASS: ./ec2c {-o /tmp/consensus.c /tmp/consensus.ec}
@@ -1041,8 +1039,8 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman
 
 		=== lus2lic Summary ===
 
-# of expected passes		871
-# of unexpected failures	88
+# of expected passes		873
+# of unexpected failures	84
 # of unexpected successes	12
 # of expected failures		37
 # of unresolved testcases	21
diff --git a/test/should_work/mapinf.lus b/test/should_work/mapinf.lus
index 0ce249e0..13c78e35 100644
--- a/test/should_work/mapinf.lus
+++ b/test/should_work/mapinf.lus
@@ -1,4 +1,4 @@
 node mapinf (t1, t2: int^10) returns (res :  bool^10);
 let
-  res = map<< lt,  10>>(t1, t2);
+  res = map<< Lustre::lt,  10>>(t1, t2);
 tel
diff --git a/test/should_work/matrice.lus b/test/should_work/matrice.lus
index 691f6096..5f077c5a 100644
--- a/test/should_work/matrice.lus
+++ b/test/should_work/matrice.lus
@@ -12,7 +12,7 @@ tel
 node matrice ( a : int ) returns ( sum: int; bid: T_fibo; T: int^m^n); 
 let 
 	bid, T = fill << fill << fibo ; m >> ; n >> ([a, a]);	
-	sum = red << red <<node plus ; m >> ; n >> (0, T); 
+	sum = red << red <<node Lustre::plus ; m >> ; n >> (0, T); 
 tel
 
 
diff --git a/test/should_work/ply01.lus b/test/should_work/ply01.lus
index 5457351b..6a2f11cf 100644
--- a/test/should_work/ply01.lus
+++ b/test/should_work/ply01.lus
@@ -1,9 +1,9 @@
 
-(* ne passe pas DoNotPoly ... *)
+(* ne passe pas DoNotPoly... Normal. *)
 node truc = map<<+,42>>;
 
 (* PASSE DoNotPoly ... *)
 node trac = map<<Lustre::iplus,42>>;
  
 (* ne passe pas DoNotPoly ... *)
-node ply01 = truc;
+node ply01 = trac;
diff --git a/test/should_work/yyy.lus b/test/should_work/yyy.lus
index da36177c..fde12bb0 100644
--- a/test/should_work/yyy.lus
+++ b/test/should_work/yyy.lus
@@ -1,2 +1,3 @@
 
-node yyy = red<< iplus, 2>>
+
+node yyy = red<< Lustre::iplus, 2>>
diff --git a/todo.org b/todo.org
index af56ec6d..1ff8abc7 100644
--- a/todo.org
+++ b/todo.org
@@ -3,14 +3,6 @@
 
 * lus2lic -exec
 
-
-** TODO oops: lus2lic internal error
-   - State "TODO"       from ""           [2013-05-14 Tue 14:35]
-	File "objlinux/lic2soc.ml", line 648, column 14
-
-./lus2lic should_work/noeudsIndependants.lus -n noeudsIndependants --gen-autotest -np
-../utils/test_lus2lic_no_node should_work/ply01.lus
-
 ** TODO oops: lus2lic internal error
    - State "TODO"       from ""           [2013-05-10 Fri 17:46]
 	File "objlinux/lic2soc.ml", line 680, column 18
diff --git a/todo.org_archive b/todo.org_archive
index 599aea97..b369cf7f 100644
--- a/todo.org_archive
+++ b/todo.org_archive
@@ -717,6 +717,30 @@ Reste à l'integrer dans file:test/lus2lic.tests/non-reg.exp
   :END:
 ../utils/test_lus2lic_no_node should_work/is_stable.lus
 
+* TODO oops: lus2lic internal error
+   - State "TODO"       from ""           [2013-05-14 Tue 14:35]
+  :PROPERTIES:
+  :ARCHIVE_TIME: 2013-05-16 Thu 13:50
+  :ARCHIVE_FILE: ~/lus2lic/todo.org
+  :ARCHIVE_OLPATH: lus2lic -exec
+  :ARCHIVE_CATEGORY: lv6
+  :ARCHIVE_TODO: TODO
+  :END:
+	File "objlinux/lic2soc.ml", line 648, column 14
+
+./lus2lic should_work/noeudsIndependants.lus -n noeudsIndependants --gen-autotest -np
+
+C'est parce que il y a un clash avec Lustre::gt qui est polymorphe,
+et donc l'alias vers gt ne genere pas de code...
+
+Il faudrait vraiment que je trouve un moyen de ne pas remplir les tables avec
+le contenu du module Lustre de facon strict (ie, le faire lazy !!)
+
+cf file:src/licTab.ml::68
+
+Bon, finalement, j'oblige les gens a ecrire Lustre::gt et puis ca marre.
+
+
 
 
 
-- 
GitLab