From 52c3e0129f57f7e1b7c506e975517b9d9809e2e9 Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Fri, 14 Mar 2008 13:32:22 +0100 Subject: [PATCH] a small change that fix an error in the non-reg tests: constant values could not be exported, while expandPack.ml was exporting it. --- src/lazyCompiler.ml | 18 ++++++------ src/symbolTab.mli | 8 +++--- src/test/should_work/NONREG/Int.lus | 43 +++++++++++++++-------------- src/test/test.res.exp | 8 ++++-- 4 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml index 16ee50d8..2b3e2ef4 100644 --- a/src/lazyCompiler.ml +++ b/src/lazyCompiler.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 13/03/2008 (at 17:26) by Erwan Jahier> *) +(** Time-stamp: <modified the 14/03/2008 (at 13:28) by Erwan Jahier> *) open Lxm @@ -335,16 +335,18 @@ and (const_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> (string_of_type_eff teff_body) ^ "") )) | Bool_const_eff _ - | Int_const_eff _ - | Real_const_eff _ + | Int_const_eff _ + | Real_const_eff _ | Struct_const_eff (_,_) | Array_const_eff (_,_) -> - print_string ( - (Ident.string_of_long cn) ^ " = " ^ - (string_of_const_eff prov_const_eff) ^ " can be provided."); - assert false - (* ougth to be catched by the syntax checking *) + if prov_const_eff = body_const_eff then + body_const_eff + else + raise(Compile_error ( + const_def.src, + " provided constant does not match with its definition.")) + and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name -> SyntaxTreeCore.type_info srcflagged -> CompiledData.type_eff) = diff --git a/src/symbolTab.mli b/src/symbolTab.mli index a80772df..3f07f421 100644 --- a/src/symbolTab.mli +++ b/src/symbolTab.mli @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 20/02/2008 (at 14:43) by Erwan Jahier> *) +(** Time-stamp: <modified the 14/03/2008 (at 11:11) by Erwan Jahier> *) (********************************************************** Sous-module pour SyntaxTab @@ -35,9 +35,9 @@ val add_import_type : t -> Ident.t -> Ident.long -> unit val add_import_node : t -> Ident.t -> Ident.long -> unit (** Add local items declaration *) -val add_type : t -> Ident.t -> type_info Lxm.srcflagged -> unit -val add_const : t -> Ident.t -> const_info Lxm.srcflagged -> unit -val add_node : t -> Ident.t -> node_info Lxm.srcflagged -> unit +val add_type : t -> Ident.t -> type_info Lxm.srcflagged -> unit +val add_const : t -> Ident.t -> const_info Lxm.srcflagged -> unit +val add_node : t -> Ident.t -> node_info Lxm.srcflagged -> unit (* Itérer sur les items *) diff --git a/src/test/should_work/NONREG/Int.lus b/src/test/should_work/NONREG/Int.lus index 93b4052b..0be7a8c8 100644 --- a/src/test/should_work/NONREG/Int.lus +++ b/src/test/should_work/NONREG/Int.lus @@ -1,30 +1,33 @@ model Int -needs const n:int; -provides -type Int; -const zero: Int; -function incr (x: Int) returns (incr: Int); -function add (x,y: Int) returns (sum: Int); -body -type Int = bool^n; -const zero = false^n; -function incr (x: Int) returns (incr: Int); -var co: bool; -let + needs + const n:int; + + provides + type Int; + const zero: Int; + function incr (x: Int) returns (incr: Int); + function add (x,y: Int) returns (sum: Int); + + body + type Int = bool^n; + const zero = false^n; + function incr (x: Int) returns (incr: Int); + var co: bool; + let (incr,co) = map_red<<fulladd,n>>(true,x,zero); -tel + tel -function fulladd(ci, x, y: bool) returns (s, co: bool); -let + function fulladd(ci, x, y: bool) returns (s, co: bool); + let s = ci xor (x xor y); co = (ci and x) or (x and y) or (y and ci); -tel + tel -function add (x,y: Int) returns (sum: Int); -var co: bool; -let + function add (x,y: Int) returns (sum: Int); + var co: bool; + let (sum, co) = map_red<<fulladd,n>>(false,x,y); -tel + tel end diff --git a/src/test/test.res.exp b/src/test/test.res.exp index ebb2dbad..238734a9 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -58,9 +58,11 @@ End of Syntax table dump. Exported types: type Int8::Int = Int8::Int Exported constants: -Int8::n = 8 can be provided. -*** oops: an internal error occurred in file lazyCompiler.ml, line 346, column 5 -*** when compiling lustre program should_work/NONREG/Int.lus + const Int8::n = 8 + const Int8::zero = [false, false, false, false, false, false, false, false] + Exported nodes: +*** Error in file "should_work/NONREG/Int.lus", line 17, col 14 to 20, token 'map_red': unknown node + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 should_work/NONREG/PCOND.lus -- GitLab