root/trunk/ProjectFortress/static_tests/ArrayElements.fss

Revision 2243, 1.5 kB (checked in by nbeckman, 5 months ago)

[typechecker] We now do a static test to make sure that objects and traits only extend traits.

Line 
1 (*******************************************************************************
2     Copyright 2008 Sun Microsystems, Inc.,
3     4150 Network Circle, Santa Clara, California 95054, U.S.A.
4     All rights reserved.
5
6     U.S. Government Rights - Commercial software.
7     Government users are subject to the Sun Microsystems, Inc. standard
8     license agreement and applicable provisions of the FAR and its supplements.
9
10     Use is subject to license terms.
11
12     This distribution may include materials developed by third parties.
13
14     Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
15     trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
16  ******************************************************************************)
17
18 component ArrayElements
19   export Executable
20
21   trait FakeTrait end
22   object FakerTrait extends { FakeTrait } end
23
24   foo() : () = do
25
26     var a:Array2[\IntLiteral,0,3,0,3\]
27     a := [1 2 3; 4 5 6; 7 8 9]
28  
29     var b:Array2[\IntLiteral,0,2,0,2\]
30     b := [ 3 4
31            5 6 ]
32     b := [ 3 4;
33            5 6 ]
34     b := [ 3 4
35          ; 5 6 ]
36     b := [3 4; 5 6]
37
38     var c:Array3[\IntLiteral,0,3,0,3,0,3\]
39     c := [ 1 0 0
40            0 1 0
41            0 0 1;;  0 1 0
42                     1 0 1
43                     0 1 0;; 1 0 1
44                             0 1 0
45                             1 0 1]
46
47     var d:Array1[\FakeTrait,0,2\]
48     d := [[\FakeTrait,0,2\] FakerTrait FakerTrait ]
49
50   end
51
52   run(args:String...):() = ()
53 end
Note: See TracBrowser for help on using the browser.