Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /tests/trunk/bugs/tests.obsolete/bug641.sml
ViewVC logotype

Annotation of /tests/trunk/bugs/tests.obsolete/bug641.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 548 - (view) (download)
Original Path: sml/trunk/tests/bugs/tests/bug641.sml

1 : dbm 548 (* bug641.sml *)
2 :    
3 :     signature SIG1 =
4 :     sig
5 :     type t
6 :     type u
7 :     val x:t
8 :     val y:u
9 :     end;
10 :    
11 :     structure A: SIG1 =
12 :     struct
13 :     type t=int
14 :     type u=bool
15 :     val x=5
16 :     val y=true
17 :     end;
18 :    
19 :     signature SIG2 =
20 :     sig
21 :     functor Foo(X:SIG1) : sig val z : A.t val w: X.t end
22 :     end;
23 :    
24 :     (* This was to test if the restriction on what names may be used -- relevant
25 :     for separate compilation -- was enforced in v88 *)
26 :    
27 :     structure B : SIG2 =
28 :     struct
29 :     functor Foo(X:SIG1) =
30 :     struct
31 :     val z = A.x + 1
32 :     val w = X.x
33 :     type foo = bool
34 :     end
35 :     end;
36 :    
37 :     (* This was to test if signature contraints of SIG2 were propagated down to the body
38 :     of the functor. Pleasantly, it is *)
39 :    
40 :     open B;
41 :    
42 :     structure C = Foo(A);
43 :    
44 :     structure D : SIG1 =
45 :     struct
46 :     type t = bool
47 :     type u = int
48 :     val x = false
49 :     val y = 7
50 :     end;
51 :    
52 :     structure E = Foo(D);
53 :    
54 :     C.w;
55 :     (* val it = 1 : A.t -- should have been equal to A.x = 5 !!!!! *)
56 :    
57 :     A.x;
58 :     (* val it = 5 : A.t *)
59 :    
60 :     C.z;
61 :     (* val it = 6 : A.t -- rightly so *)
62 :    
63 :     E.z;
64 :     (* val it = 6 : A.t -- again rightly so *)
65 :    
66 :     E.w; (* should have been false *)
67 :     (* val it = Error: Compiler bug: PrintVal.switch: none of the datacons matched *)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0