Jens Geyer | 944b8e6 | 2022-09-11 12:30:35 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 20 | // Naming testcases, sepcifically for these tickets (but not limited to them) |
| 21 | // THRIFT-2508 Uncompileable C# code due to language keywords in IDL |
| 22 | // THRIFT-2557 error CS0542 member names cannot be the same as their enclosing type |
| 23 | |
| 24 | |
| 25 | struct using { |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 26 | 1: double single |
| 27 | 2: double integer |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | struct delegate { |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 31 | 1: string partial |
| 32 | 2: delegate delegate |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | struct get { |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 36 | 1: bool sbyte |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | struct partial { |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 40 | 1: using using |
henrique | 2f34da7 | 2015-02-05 12:39:34 +1100 | [diff] [blame] | 41 | 2: bool read |
| 42 | 3: bool write |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 43 | } |
| 44 | |
Roger Meier | 16c164e | 2014-08-07 03:09:23 +0200 | [diff] [blame] | 45 | enum Maybe { |
| 46 | JUST = 1, |
| 47 | TRUE = 2, |
| 48 | FALSE = 3 |
| 49 | } |
| 50 | |
| 51 | enum Either { |
| 52 | LEFT = 1, |
| 53 | RIGHT = 2 |
| 54 | } |
| 55 | |
| 56 | struct foldr { |
| 57 | 1: string id |
| 58 | } |
| 59 | |
| 60 | struct of { |
| 61 | 1: string let |
| 62 | 2: string where |
| 63 | } |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 64 | |
alisdair sullivan | ca44a62 | 2014-08-07 06:32:37 -0700 | [diff] [blame] | 65 | struct ofOf { |
| 66 | 1: of Of |
| 67 | } |
| 68 | |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 69 | |
| 70 | struct ClassAndProp { |
| 71 | 1: bool ClassAndProp |
| 72 | 2: bool ClassAndProp_ |
| 73 | 3: bool ClassAndProp__ |
| 74 | 4: bool ClassAndProper |
| 75 | } |
| 76 | |
| 77 | struct second_chance { |
| 78 | 1: bool SECOND_CHANCE |
| 79 | 2: bool SECOND_CHANCE_ |
| 80 | 3: bool SECOND_CHANCE__ |
| 81 | 4: bool SECOND_CHANCES |
| 82 | } |
| 83 | |
| 84 | struct NOW_EAT_THIS { |
| 85 | 1: bool now_eat_this |
| 86 | 2: bool now_eat_this_ |
| 87 | 3: bool now_eat_this__ |
| 88 | 4: bool now_eat_this_and_this |
| 89 | } |
| 90 | |
| 91 | struct TheEdgeCase { |
| 92 | 1: bool theEdgeCase |
| 93 | 2: bool theEdgeCase_ |
| 94 | 3: bool theEdgeCase__ |
| 95 | 4: bool TheEdgeCase |
| 96 | 5: bool TheEdgeCase_ |
| 97 | 6: bool TheEdgeCase__ |
| 98 | } |
| 99 | |
| 100 | struct Tricky_ { |
| 101 | 1: bool tricky |
| 102 | 2: bool Tricky |
| 103 | } |
| 104 | |
| 105 | struct Nested { |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 106 | 1: ClassAndProp ClassAndProp |
| 107 | 2: second_chance second_chance |
| 108 | 3: NOW_EAT_THIS NOW_EAT_THIS |
| 109 | 4: TheEdgeCase TheEdgeCase |
| 110 | 5: Tricky_ Tricky_ |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 111 | 6: Nested Nested |
| 112 | } |
| 113 | |
| 114 | exception Problem_ { |
| 115 | 1: bool problem |
| 116 | 2: bool Problem |
| 117 | } |
| 118 | |
Jens Geyer | 154d154 | 2022-09-10 14:30:15 +0200 | [diff] [blame] | 119 | struct Thrift5626 { |
| 120 | 1: i8 i8 |
| 121 | 2: i16 i16 |
| 122 | 3: i32 i32 |
| 123 | 4: i64 i64 |
| 124 | 5: uuid uuid |
| 125 | 6: string string |
| 126 | 7: binary binary |
| 127 | 8: bool bool |
| 128 | 9: byte byte |
| 129 | 10: list<string> list |
| 130 | 11: set<string> set |
| 131 | 12: map<string,string> map |
| 132 | } |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 133 | |
| 134 | service extern { |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 135 | delegate event(1: partial get) |
| 136 | void Foo(1: Nested Foo_args) throws (1: Problem_ Foo_result) |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 137 | } |
| 138 | |
Roger Meier | 16c164e | 2014-08-07 03:09:23 +0200 | [diff] [blame] | 139 | service qualified { |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 140 | Maybe maybe(1: Maybe foldr) |
| 141 | Either either(1: foldr of) |
Roger Meier | 16c164e | 2014-08-07 03:09:23 +0200 | [diff] [blame] | 142 | } |
Jens Geyer | 6f86f9a | 2014-07-08 21:31:52 +0200 | [diff] [blame] | 143 | // eof |