* THRIFT-4655 Parser fails on the word "from"
Client: Compiler (general)
Patch: Jens Geyer
This also fixes an unhandled "normalize" case with enums in netstd that came up during tests for this ticket.
This closes #2715
diff --git a/compiler/cpp/test/CMakeLists.txt b/compiler/cpp/test/CMakeLists.txt
index b80f060..6cf309b 100644
--- a/compiler/cpp/test/CMakeLists.txt
+++ b/compiler/cpp/test/CMakeLists.txt
@@ -18,8 +18,8 @@
#
file(GLOB KEYWORD_SAMPLES "${CMAKE_CURRENT_SOURCE_DIR}/keyword-samples/*.thrift")
-set(KEYWORD_LANGS ${thrift_compiler_LANGS})
-LIST(REMOVE_ITEM KEYWORD_LANGS swift) # in Swift you can escape reserved words
+set(KEYWORD_LANGS php) # the whole ticket THRIFT-4655 is only about PHP so leave other languages alone
+LIST(REMOVE_ITEM KEYWORD_LANGS swift) # in Swift you can escape reserved words (and in other languages as well)
foreach(LANG ${KEYWORD_LANGS})
foreach(SAMPLE ${KEYWORD_SAMPLES})
get_filename_component(FILENAME ${SAMPLE} NAME_WE)
diff --git a/compiler/cpp/test/keyword-samples/const1_return.thrift b/compiler/cpp/test/keyword-samples/const1_return.thrift
index f75f980..5a120c2 100644
--- a/compiler/cpp/test/keyword-samples/const1_return.thrift
+++ b/compiler/cpp/test/keyword-samples/const1_return.thrift
@@ -17,4 +17,7 @@
* under the License.
*/
+
+namespace * keyword_test_007
+
const bool return = 0
diff --git a/compiler/cpp/test/keyword-samples/enum1_return.thrift b/compiler/cpp/test/keyword-samples/enum1_return.thrift
index b3755e0..1dcf594 100644
--- a/compiler/cpp/test/keyword-samples/enum1_return.thrift
+++ b/compiler/cpp/test/keyword-samples/enum1_return.thrift
@@ -17,5 +17,8 @@
* under the License.
*/
+
+namespace * keyword_test_008
+
enum return {
}
diff --git a/compiler/cpp/test/keyword-samples/enum2_return.thrift b/compiler/cpp/test/keyword-samples/enum2_return.thrift
index 1c26cc8..e357313 100644
--- a/compiler/cpp/test/keyword-samples/enum2_return.thrift
+++ b/compiler/cpp/test/keyword-samples/enum2_return.thrift
@@ -17,6 +17,9 @@
* under the License.
*/
+
+namespace * keyword_test_009
+
enum enum_name {
return
}
diff --git a/compiler/cpp/test/keyword-samples/exception1_return.thrift b/compiler/cpp/test/keyword-samples/exception1_return.thrift
index d89d9e8..eb31a47 100644
--- a/compiler/cpp/test/keyword-samples/exception1_return.thrift
+++ b/compiler/cpp/test/keyword-samples/exception1_return.thrift
@@ -17,4 +17,6 @@
* under the License.
*/
+namespace * keyword_test_010
+
exception return {}
diff --git a/compiler/cpp/test/keyword-samples/exception2_return.thrift b/compiler/cpp/test/keyword-samples/exception2_return.thrift
index e1289ed..6193fc0 100644
--- a/compiler/cpp/test/keyword-samples/exception2_return.thrift
+++ b/compiler/cpp/test/keyword-samples/exception2_return.thrift
@@ -17,6 +17,8 @@
* under the License.
*/
+namespace * keyword_test_011
+
exception exception_name {
1: required i8 return
}
diff --git a/compiler/cpp/test/keyword-samples/service1_return.thrift b/compiler/cpp/test/keyword-samples/service1_return.thrift
index c52abb6..da36b1c 100644
--- a/compiler/cpp/test/keyword-samples/service1_return.thrift
+++ b/compiler/cpp/test/keyword-samples/service1_return.thrift
@@ -17,4 +17,6 @@
* under the License.
*/
+namespace * keyword_test_012
+
service return {}
diff --git a/compiler/cpp/test/keyword-samples/service2_return.thrift b/compiler/cpp/test/keyword-samples/service2_return.thrift
index 0c77a26..3150754 100644
--- a/compiler/cpp/test/keyword-samples/service2_return.thrift
+++ b/compiler/cpp/test/keyword-samples/service2_return.thrift
@@ -17,6 +17,8 @@
* under the License.
*/
+namespace * keyword_test_013
+
service service_name {
bool function_name(1: i32 return)
}
diff --git a/compiler/cpp/test/keyword-samples/service3_return.thrift b/compiler/cpp/test/keyword-samples/service3_return.thrift
index fe084d2..f6909ab 100644
--- a/compiler/cpp/test/keyword-samples/service3_return.thrift
+++ b/compiler/cpp/test/keyword-samples/service3_return.thrift
@@ -17,6 +17,8 @@
* under the License.
*/
+namespace * keyword_test_014
+
service service_name {
void return()
}
diff --git a/compiler/cpp/test/keyword-samples/service4_return.thrift b/compiler/cpp/test/keyword-samples/service4_return.thrift
index 53993f1..72da51c 100644
--- a/compiler/cpp/test/keyword-samples/service4_return.thrift
+++ b/compiler/cpp/test/keyword-samples/service4_return.thrift
@@ -17,6 +17,8 @@
* under the License.
*/
+namespace * keyword_test_001
+
exception exception_name {}
service service_name {
diff --git a/compiler/cpp/test/keyword-samples/struct1_return.thrift b/compiler/cpp/test/keyword-samples/struct1_return.thrift
index 9664010..0029029 100644
--- a/compiler/cpp/test/keyword-samples/struct1_return.thrift
+++ b/compiler/cpp/test/keyword-samples/struct1_return.thrift
@@ -17,4 +17,6 @@
* under the License.
*/
+namespace * keyword_test_002
+
struct return {}
diff --git a/compiler/cpp/test/keyword-samples/struct2_return.thrift b/compiler/cpp/test/keyword-samples/struct2_return.thrift
index db123e5..d34d0a7 100644
--- a/compiler/cpp/test/keyword-samples/struct2_return.thrift
+++ b/compiler/cpp/test/keyword-samples/struct2_return.thrift
@@ -17,6 +17,8 @@
* under the License.
*/
+namespace * keyword_test_003
+
struct struct_name {
1: required bool return = 1
}
diff --git a/compiler/cpp/test/keyword-samples/typedef1_return.thrift b/compiler/cpp/test/keyword-samples/typedef1_return.thrift
index 142d51f..be97586 100644
--- a/compiler/cpp/test/keyword-samples/typedef1_return.thrift
+++ b/compiler/cpp/test/keyword-samples/typedef1_return.thrift
@@ -16,4 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
+namespace * keyword_test_004
+
typedef bool return
diff --git a/compiler/cpp/test/keyword-samples/union1_return.thrift b/compiler/cpp/test/keyword-samples/union1_return.thrift
index af7a8e7..43cd167 100644
--- a/compiler/cpp/test/keyword-samples/union1_return.thrift
+++ b/compiler/cpp/test/keyword-samples/union1_return.thrift
@@ -17,4 +17,7 @@
* under the License.
*/
+
+namespace * keyword_test_005
+
union return {}
diff --git a/compiler/cpp/test/keyword-samples/union2_return.thrift b/compiler/cpp/test/keyword-samples/union2_return.thrift
index 3361a1a..5ff7955 100644
--- a/compiler/cpp/test/keyword-samples/union2_return.thrift
+++ b/compiler/cpp/test/keyword-samples/union2_return.thrift
@@ -17,6 +17,10 @@
* under the License.
*/
+
+
+namespace * keyword_test_006
+
union union_name {
1: optional bool return=1
}