summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Bench <spencer.bench@gmail.com>2017-03-29 12:09:25 -0600
committerWouter van Oortmerssen <aardappel@gmail.com>2017-03-29 11:09:25 -0700
commitccfa317486199d4fe97cac08bbe37e498651589f (patch)
tree52bab32014eaf82e15edfa22e1023b4dde5d9cfd
parenta5cc2092a62e7ee6541cc380b861cf7ac4de8cb0 (diff)
downloadflatbuffers-ccfa317486199d4fe97cac08bbe37e498651589f.tar.gz
flatbuffers-ccfa317486199d4fe97cac08bbe37e498651589f.tar.bz2
flatbuffers-ccfa317486199d4fe97cac08bbe37e498651589f.zip
C#: Fixed possible conflicts between usings and user-supplied namespace (#4247)
* C#: Fixed possible conflicts between usings and user-supplied namespace C#: Added the global qualifier to using directives to prevent possible conflicts with the user-supplied namespace. Also prevents unintentional type hiding. Resolves issue #4242. * Updated C# generated code files
-rw-r--r--src/idl_gen_general.cpp2
-rw-r--r--tests/MyGame/Example/Monster.cs4
-rw-r--r--tests/MyGame/Example/Stat.cs4
-rw-r--r--tests/MyGame/Example/Test.cs4
-rw-r--r--tests/MyGame/Example/TestSimpleTableWithEnum.cs4
-rw-r--r--tests/MyGame/Example/Vec3.cs4
-rw-r--r--tests/MyGame/Example2/Monster.cs4
-rw-r--r--tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs4
-rw-r--r--tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs4
-rw-r--r--tests/namespace_test/NamespaceA/SecondTableInA.cs4
-rw-r--r--tests/namespace_test/NamespaceA/TableInFirstNS.cs4
-rw-r--r--tests/namespace_test/NamespaceC/TableInC.cs4
12 files changed, 23 insertions, 23 deletions
diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp
index 8ca39f0f..1e9f3b6a 100644
--- a/src/idl_gen_general.cpp
+++ b/src/idl_gen_general.cpp
@@ -128,7 +128,7 @@ const LanguageParameters& GetLangParams(IDLOptions::Language lang) {
"__p.",
"Table.",
"?",
- "using System;\nusing FlatBuffers;\n\n",
+ "using global::System;\nusing global::FlatBuffers;\n\n",
{
nullptr,
"///",
diff --git a/tests/MyGame/Example/Monster.cs b/tests/MyGame/Example/Monster.cs
index 1c473f30..8f76cfd8 100644
--- a/tests/MyGame/Example/Monster.cs
+++ b/tests/MyGame/Example/Monster.cs
@@ -3,8 +3,8 @@
namespace MyGame.Example
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
/// an example documentation comment: monster object
public struct Monster : IFlatbufferObject
diff --git a/tests/MyGame/Example/Stat.cs b/tests/MyGame/Example/Stat.cs
index 0fb5bd0f..1ea80501 100644
--- a/tests/MyGame/Example/Stat.cs
+++ b/tests/MyGame/Example/Stat.cs
@@ -3,8 +3,8 @@
namespace MyGame.Example
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public struct Stat : IFlatbufferObject
{
diff --git a/tests/MyGame/Example/Test.cs b/tests/MyGame/Example/Test.cs
index 92c3b912..406f5f13 100644
--- a/tests/MyGame/Example/Test.cs
+++ b/tests/MyGame/Example/Test.cs
@@ -3,8 +3,8 @@
namespace MyGame.Example
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public struct Test : IFlatbufferObject
{
diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.cs b/tests/MyGame/Example/TestSimpleTableWithEnum.cs
index bff38640..3d2a3f44 100644
--- a/tests/MyGame/Example/TestSimpleTableWithEnum.cs
+++ b/tests/MyGame/Example/TestSimpleTableWithEnum.cs
@@ -3,8 +3,8 @@
namespace MyGame.Example
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public partial struct TestSimpleTableWithEnum : IFlatbufferObject
{
diff --git a/tests/MyGame/Example/Vec3.cs b/tests/MyGame/Example/Vec3.cs
index 05525434..6ea4b0ee 100644
--- a/tests/MyGame/Example/Vec3.cs
+++ b/tests/MyGame/Example/Vec3.cs
@@ -3,8 +3,8 @@
namespace MyGame.Example
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public struct Vec3 : IFlatbufferObject
{
diff --git a/tests/MyGame/Example2/Monster.cs b/tests/MyGame/Example2/Monster.cs
index 2a0b6de4..406c4bd8 100644
--- a/tests/MyGame/Example2/Monster.cs
+++ b/tests/MyGame/Example2/Monster.cs
@@ -3,8 +3,8 @@
namespace MyGame.Example2
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public struct Monster : IFlatbufferObject
{
diff --git a/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs
index 508895f5..bb627ad3 100644
--- a/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs
+++ b/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs
@@ -3,8 +3,8 @@
namespace NamespaceA.NamespaceB
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public struct StructInNestedNS : IFlatbufferObject
{
diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs
index a2a1c0be..c33d1fbc 100644
--- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs
+++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs
@@ -3,8 +3,8 @@
namespace NamespaceA.NamespaceB
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public struct TableInNestedNS : IFlatbufferObject
{
diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.cs b/tests/namespace_test/NamespaceA/SecondTableInA.cs
index 20488288..f28ed860 100644
--- a/tests/namespace_test/NamespaceA/SecondTableInA.cs
+++ b/tests/namespace_test/NamespaceA/SecondTableInA.cs
@@ -3,8 +3,8 @@
namespace NamespaceA
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public struct SecondTableInA : IFlatbufferObject
{
diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.cs b/tests/namespace_test/NamespaceA/TableInFirstNS.cs
index 3b5659af..20f4b4be 100644
--- a/tests/namespace_test/NamespaceA/TableInFirstNS.cs
+++ b/tests/namespace_test/NamespaceA/TableInFirstNS.cs
@@ -3,8 +3,8 @@
namespace NamespaceA
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public struct TableInFirstNS : IFlatbufferObject
{
diff --git a/tests/namespace_test/NamespaceC/TableInC.cs b/tests/namespace_test/NamespaceC/TableInC.cs
index fa53ec52..c7f2c8a7 100644
--- a/tests/namespace_test/NamespaceC/TableInC.cs
+++ b/tests/namespace_test/NamespaceC/TableInC.cs
@@ -3,8 +3,8 @@
namespace NamespaceC
{
-using System;
-using FlatBuffers;
+using global::System;
+using global::FlatBuffers;
public struct TableInC : IFlatbufferObject
{