root/trunk/ProjectFortress/static_tests/CaseExpr.fss

Revision 2103, 1.9 kB (checked in by nbeckman, 5 months ago)

Added InfixJuxt? and MultiJuxt? OpRefs? to MathPrimary?. Added OpRef? to ExponentiationMI. Made MathPrimary? work in the typechecker and we changed TightJuxt? to be a special case of MathPrimary?.

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 CaseExpr
19 import Set.{...}
20 export Executable
21
22 (* Tests that various normal (not extemum) case expressions type check ok. *)
23  
24 foo(z:ZZ32,g:Generator[\ZZ32\]) : String = do
25   ignore(case z IN of
26            g => "this?" end as String)
27
28   case z of
29     g => "Did this work?"
30   end
31 end
32
33
34 run(args:String...):() = do
35   ignore(case 5 of
36            1=> "1"
37            2=> "2"
38          end as String)
39
40 (*
41  
42   (* No operator *)
43   ignore(case 5:10 of
44     2:10 => 0
45     1    => 1
46     5:10 => 1
47     else => -1
48   end as IntLiteral)
49   ignore(case 5 of
50     1 => "1"
51     2 => "2"
52     (* 3:10 => "range" won't work because of stupid IntLiteral *)
53   end as String)
54   ignore(case 5 of
55     1 => "1"
56     2 => "2"
57     (* 6:10 => "range" Won't work because of stupid IntLiteral *)
58     else => "else"
59   end as String)
60   *)
61     (* Operator *)
62     (*
63     planet = "Saturn"
64     ignore(case planet IN of
65       {"Mercury", "Venus", "Earth", "Mars"} => "inner"
66       {"Jupiter", "Saturn", "Uranus", "Neptune"} => "outer"
67       else => "remote"
68     end as String)
69
70     ignore(case 5 > of
71       4 => true
72     6 => false
73     else => false
74   end as Boolean)
75 *)
76
77 end
78
79 end
Note: See TracBrowser for help on using the browser.