(* * Basic tests for qualidents. *) module M; export Rec, Name; obj Rec = n:Name and id:Id; obj Name = string; obj Id = integer; end M; module N; import M.Rec, M.Name; obj Rec2 = n:Name and id:integer; op Foo(r:Rec, r2:Rec2, n:Name, id:integer)->(s:string,i:integer) = ( n = r.n; id = r.id; -- ERROR: type Id not def'd {r.n, r.id}; -- ERROR: type Id not def'd r = {"Hi", 2}; -- ERROR: incompat types in -- This one is subtle here. The deal -- is that since Id is not imported, -- the imported type Rec is def'd as -- the type "Name and nil", which means -- var r of this type is incompat with -- {"Hi", 2}, which is of type "string -- and integer". I don't necessarily -- like the fact that this leads to an -- unclear error message, but it's a -- sound semantics based on the -- non-transitive name importing rule. -- The only thing I'd suggest is to -- have a more robust and explanatory -- error reporting facility. r2 = {"Hi", 2}; r2 = {"Hi", "There"}; -- ERROR: incompat types in = ); end N;