blob: 6201923e0171a09fc948ae6385861cf4a14e1e18 [file] [log] [blame]
Jens Geyerae0b22c2014-09-04 23:04:21 +02001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 * Contains some contributions under the Thrift Software License.
20 * Please see doc/old-thrift-license.txt in the Thrift distribution for
21 * details.
22 */
23
24enum MyEnum1 {
25 ME1_0 = 0,
26 ME1_1 = 1,
27 ME1_2,
28 ME1_3,
29 ME1_5 = 5,
30 ME1_6,
31}
32
33enum MyEnum2 {
34 ME2_0,
35 ME2_1,
36 ME2_2,
37}
38
Jens Geyer86b309c2014-09-11 23:54:35 +020039enum MyEnum2_again {
40 // enum value identifiers may appear again in another enum type
41 ME0_1,
42 ME1_1,
43 ME2_1,
44 ME3_1,
45}
46
Jens Geyerae0b22c2014-09-04 23:04:21 +020047enum MyEnum3 {
48 ME3_0,
49 ME3_1,
50 ME3_N2 = -2,
51 ME3_N1,
52 ME3_D0,
53 ME3_D1,
54 ME3_9 = 9,
55 ME3_10,
56}
57
58enum MyEnum4 {
59 ME4_A = 0x7ffffffd
60 ME4_B
61 ME4_C
62 // attempting to define another enum value here fails
63 // with an overflow error, as we overflow values that can be
64 // represented with an i32.
65}
66
Jens Geyerae0b22c2014-09-04 23:04:21 +020067struct MyStruct {
68 1: MyEnum2 me2_2 = MyEnum1.ME2_2
69 2: MyEnum3 me3_n2 = MyEnum3.ME3_N2
70 3: MyEnum3 me3_d1 = MyEnum3.ME3_D1
71}
72