diff --git a/src/evalType.ml b/src/evalType.ml index 7e3a5e4685e6ebc3788b123c101385dd7a375589..45f1c7de8fdd2e269e0458693752ab79fe8ae50e 100644 --- a/src/evalType.ml +++ b/src/evalType.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 12/09/2008 (at 15:22) by Erwan Jahier> *) +(** Time-stamp: <modified the 04/11/2008 (at 16:57) by Erwan Jahier> *) open Predef @@ -210,5 +210,33 @@ and (eval_by_name_type : Eff.id_solver -> Eff.by_name_op -> Lxm.t -> assert false (* failwith "Finish me: anonymous struct not yet supported" *) - | Eff.STRUCT (pn,opid) -> [id_solver.id2type opid lxm] + | Eff.STRUCT (pn,opid) -> + let struct_type = id_solver.id2type opid lxm in + let _ = + match struct_type with + | Struct_type_eff(sn, fl) -> + List.iter + (fun (fn,fv) -> + let fn, lxm = fn.it, fn.src in + let (ft,fopt) = + try List.assoc fn fl with Not_found -> + let msg = "type error: bad field" ^ (Ident.to_string fn) in + raise (Compile_error(lxm, msg)) + in + (* let's check the type of fv *) + let fv_type = f id_solver fv in + match UnifyType.f [ft] fv_type with + | UnifyType.Unif t -> + (* XXX cannot occur as long as we do not have + user-level polymorphism (really?).*) + () + | UnifyType.Equal -> () + | UnifyType.Ko msg -> raise (Compile_error(lxm, msg)) + ) + namargs + | _ -> + raise (Compile_error(lxm, "type error: a structure is expected")) + + in + [struct_type] diff --git a/src/split.ml b/src/split.ml index 655b35d1c8fd467bac768fb8abaa81e1220e9741..24ea759b55c20e754e0ef60cfae48740f5dd1f30 100644 --- a/src/split.ml +++ b/src/split.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 03/11/2008 (at 09:50) by Erwan Jahier> *) +(** Time-stamp: <modified the 04/11/2008 (at 16:48) by Erwan Jahier> *) open Lxm diff --git a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus b/src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus index abead384062403fa3862533099a8dc4e55882f85..56f6a143dc8ca3e97ad13669a40af63a048d0d51 100644 --- a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus +++ b/src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus @@ -80,8 +80,9 @@ tel node iterated_isElementOf_(acc_in : T_isElementOf_; elt_in : elementType) returns (acc_out : T_isElementOf_); let - acc_out = T_isElementOf_{eltToSearch = acc_in.eltToSearch; - iselementof = acc_in or _isEqualTo_(acc_in.eltToSearch, elt_in)}; + acc_out = T_isElementOf_{ + eltToSearch = acc_in.eltToSearch; + iselementof = acc_in.iselementof or _isEqualTo_(acc_in.eltToSearch, elt_in)}; tel diff --git a/src/test/test.res.exp b/src/test/test.res.exp index 6d42419fdef0daa711841cd9a7b65a4e15e75656..7b53623a8abb8b5f8bb63725a1b55a8e03734958 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -18100,7 +18100,7 @@ returns ( acc_out:_intArray::T_isElementOf_); let acc_out = - _intArray::T_isElementOf_{eltToSearch=acc_in.eltToSearch;iselementof=acc_in + _intArray::T_isElementOf_{eltToSearch=acc_in.eltToSearch;iselementof=acc_in.iselementof or intArray::_isEqualTo_(acc_in.eltToSearch, elt_in)}; tel -- end of node intArray::iterated_isElementOf_