Commit 145033c0 authored by Sydney Acksman's avatar Sydney Acksman

Adjust based on review feedback

parent cd11d541
...@@ -44,7 +44,7 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \ ...@@ -44,7 +44,7 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
# Note that this deliberately does *not* include old_extensions1.proto # Note that this deliberately does *not* include old_extensions1.proto
# and old_extensions2.proto, which are generated with an older version # and old_extensions2.proto, which are generated with an older version
# of protoc. # of protoc.
$PROTOC -Isrc -Icsharp/protos -Icsharp/protos/extensions \ $PROTOC -Isrc -Icsharp/protos \
--csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \ --csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \
--descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \ --descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \
--include_source_info \ --include_source_info \
...@@ -58,9 +58,9 @@ $PROTOC -Isrc -Icsharp/protos -Icsharp/protos/extensions \ ...@@ -58,9 +58,9 @@ $PROTOC -Isrc -Icsharp/protos -Icsharp/protos/extensions \
unittest.proto \ unittest.proto \
unittest_import.proto \ unittest_import.proto \
unittest_import_public.proto \ unittest_import_public.proto \
extensions_a.proto \ extensions_issue6936_a.proto \
extensions_b.proto \ extensions_issue6936_b.proto \
extensions_c.proto \ extensions_issue6936_c.proto \
google/protobuf/unittest_well_known_types.proto \ google/protobuf/unittest_well_known_types.proto \
google/protobuf/test_messages_proto3.proto \ google/protobuf/test_messages_proto3.proto \
google/protobuf/test_messages_proto2.proto google/protobuf/test_messages_proto2.proto
......
syntax = "proto3";
import "extensions_a.proto";
option csharp_namespace = "Google.Protobuf.TestProtos.Extensions";
// This file is used as part of a unit test for issue 6936
// We don't need to use it, we just have to import it in c
message Foo {
option (opt) = "bar";
}
\ No newline at end of file
syntax = "proto3"; syntax = "proto3";
option csharp_namespace = "Google.Protobuf.TestProtos.Extensions"; package unittest_issues;
option csharp_namespace = "UnitTest.Issues.TestProtos";
// This file is used as part of a unit test for issue 6936 // This file is used as part of a unit test for issue 6936
// We don't need to use it, we just have to import it in both b and c // We don't need to use it, we just have to import it in both
// "extensions_issue6936_b.proto" and "extensions_issue6936_c.proto"
import "google/protobuf/descriptor.proto"; import "google/protobuf/descriptor.proto";
......
syntax = "proto3";
import "extensions_issue6936_a.proto";
package unittest_issues;
option csharp_namespace = "UnitTest.Issues.TestProtos";
// This file is used as part of a unit test for issue 6936
// We don't need to use it, we just have to import it in "extensions_issue6936_c.proto"
message Foo {
option (opt) = "foo";
}
\ No newline at end of file
syntax = "proto3"; syntax = "proto3";
import "extensions_a.proto"; import "extensions_issue6936_a.proto";
import "extensions_b.proto"; import "extensions_issue6936_b.proto";
option csharp_namespace = "Google.Protobuf.TestProtos.Extensions"; package unittest_issues;
option csharp_namespace = "UnitTest.Issues.TestProtos";
// This file is used as part of a unit test for issue 6936 // This file is used as part of a unit test for issue 6936
// We don't need to use it, we just have to load it at runtime // We don't need to use it, we just have to load it at runtime
message Bar { message Bar {
option (opt) = "foo"; option (opt) = "bar";
Foo foo = 1; Foo foo = 1;
} }
\ No newline at end of file
// <auto-generated> // <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: extensions_a.proto // source: extensions_issue6936_a.proto
// </auto-generated> // </auto-generated>
#pragma warning disable 1591, 0612, 3021 #pragma warning disable 1591, 0612, 3021
#region Designer generated code #region Designer generated code
...@@ -9,34 +9,34 @@ using pb = global::Google.Protobuf; ...@@ -9,34 +9,34 @@ using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections; using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection; using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic; using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos.Extensions { namespace UnitTest.Issues.TestProtos {
/// <summary>Holder for reflection information generated from extensions_a.proto</summary> /// <summary>Holder for reflection information generated from extensions_issue6936_a.proto</summary>
public static partial class ExtensionsAReflection { public static partial class ExtensionsIssue6936AReflection {
#region Descriptor #region Descriptor
/// <summary>File descriptor for extensions_a.proto</summary> /// <summary>File descriptor for extensions_issue6936_a.proto</summary>
public static pbr::FileDescriptor Descriptor { public static pbr::FileDescriptor Descriptor {
get { return descriptor; } get { return descriptor; }
} }
private static pbr::FileDescriptor descriptor; private static pbr::FileDescriptor descriptor;
static ExtensionsAReflection() { static ExtensionsIssue6936AReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChJleHRlbnNpb25zX2EucHJvdG8aIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlw", "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9hLnByb3RvEg91bml0dGVzdF9pc3N1",
"dG9yLnByb3RvOi4KA29wdBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0", "ZXMaIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlwdG9yLnByb3RvOi4KA29wdBIf",
"aW9ucxjQhgMgASgJQiiqAiVHb29nbGUuUHJvdG9idWYuVGVzdFByb3Rvcy5F", "Lmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjQhgMgASgJQh2qAhpV",
"eHRlbnNpb25zYgZwcm90bzM=")); "bml0VGVzdC5Jc3N1ZXMuVGVzdFByb3Rvc2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, }, new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, new pb::Extension[] { ExtensionsAExtensions.Opt }, null)); new pbr::GeneratedClrTypeInfo(null, new pb::Extension[] { ExtensionsIssue6936AExtensions.Opt }, null));
} }
#endregion #endregion
} }
/// <summary>Holder for extension identifiers generated from the top level of extensions_a.proto</summary> /// <summary>Holder for extension identifiers generated from the top level of extensions_issue6936_a.proto</summary>
public static partial class ExtensionsAExtensions { public static partial class ExtensionsIssue6936AExtensions {
public static readonly pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, string> Opt = public static readonly pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, string> Opt =
new pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, string>(50000, pb::FieldCodec.ForString(400002, "")); new pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, string>(50000, pb::FieldCodec.ForString(400002, ""));
} }
......
// <auto-generated> // <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: extensions_b.proto // source: extensions_issue6936_b.proto
// </auto-generated> // </auto-generated>
#pragma warning disable 1591, 0612, 3021 #pragma warning disable 1591, 0612, 3021
#region Designer generated code #region Designer generated code
...@@ -9,28 +9,28 @@ using pb = global::Google.Protobuf; ...@@ -9,28 +9,28 @@ using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections; using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection; using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic; using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos.Extensions { namespace UnitTest.Issues.TestProtos {
/// <summary>Holder for reflection information generated from extensions_b.proto</summary> /// <summary>Holder for reflection information generated from extensions_issue6936_b.proto</summary>
public static partial class ExtensionsBReflection { public static partial class ExtensionsIssue6936BReflection {
#region Descriptor #region Descriptor
/// <summary>File descriptor for extensions_b.proto</summary> /// <summary>File descriptor for extensions_issue6936_b.proto</summary>
public static pbr::FileDescriptor Descriptor { public static pbr::FileDescriptor Descriptor {
get { return descriptor; } get { return descriptor; }
} }
private static pbr::FileDescriptor descriptor; private static pbr::FileDescriptor descriptor;
static ExtensionsBReflection() { static ExtensionsIssue6936BReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChJleHRlbnNpb25zX2IucHJvdG8aEmV4dGVuc2lvbnNfYS5wcm90byIOCgNG", "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9iLnByb3RvEg91bml0dGVzdF9pc3N1",
"b286B4K1GANiYXJCKKoCJUdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zLkV4", "ZXMaHGV4dGVuc2lvbnNfaXNzdWU2OTM2X2EucHJvdG8iDgoDRm9vOgeCtRgD",
"dGVuc2lvbnNiBnByb3RvMw==")); "Zm9vQh2qAhpVbml0VGVzdC5Jc3N1ZXMuVGVzdFByb3Rvc2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.Extensions.ExtensionsAReflection.Descriptor, }, new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.ExtensionsIssue6936AReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Extensions.Foo), global::Google.Protobuf.TestProtos.Extensions.Foo.Parser, null, null, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Foo), global::UnitTest.Issues.TestProtos.Foo.Parser, null, null, null, null, null)
})); }));
} }
#endregion #endregion
...@@ -45,7 +45,7 @@ namespace Google.Protobuf.TestProtos.Extensions { ...@@ -45,7 +45,7 @@ namespace Google.Protobuf.TestProtos.Extensions {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Protobuf.TestProtos.Extensions.ExtensionsBReflection.Descriptor.MessageTypes[0]; } get { return global::UnitTest.Issues.TestProtos.ExtensionsIssue6936BReflection.Descriptor.MessageTypes[0]; }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
......
// <auto-generated> // <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: extensions_c.proto // source: extensions_issue6936_c.proto
// </auto-generated> // </auto-generated>
#pragma warning disable 1591, 0612, 3021 #pragma warning disable 1591, 0612, 3021
#region Designer generated code #region Designer generated code
...@@ -9,29 +9,30 @@ using pb = global::Google.Protobuf; ...@@ -9,29 +9,30 @@ using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections; using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection; using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic; using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos.Extensions { namespace UnitTest.Issues.TestProtos {
/// <summary>Holder for reflection information generated from extensions_c.proto</summary> /// <summary>Holder for reflection information generated from extensions_issue6936_c.proto</summary>
public static partial class ExtensionsCReflection { public static partial class ExtensionsIssue6936CReflection {
#region Descriptor #region Descriptor
/// <summary>File descriptor for extensions_c.proto</summary> /// <summary>File descriptor for extensions_issue6936_c.proto</summary>
public static pbr::FileDescriptor Descriptor { public static pbr::FileDescriptor Descriptor {
get { return descriptor; } get { return descriptor; }
} }
private static pbr::FileDescriptor descriptor; private static pbr::FileDescriptor descriptor;
static ExtensionsCReflection() { static ExtensionsIssue6936CReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChJleHRlbnNpb25zX2MucHJvdG8aEmV4dGVuc2lvbnNfYS5wcm90bxoSZXh0", "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9jLnByb3RvEg91bml0dGVzdF9pc3N1",
"ZW5zaW9uc19iLnByb3RvIiEKA0JhchIRCgNmb28YASABKAsyBC5Gb286B4K1", "ZXMaHGV4dGVuc2lvbnNfaXNzdWU2OTM2X2EucHJvdG8aHGV4dGVuc2lvbnNf",
"GANmb29CKKoCJUdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zLkV4dGVuc2lv", "aXNzdWU2OTM2X2IucHJvdG8iMQoDQmFyEiEKA2ZvbxgBIAEoCzIULnVuaXR0",
"bnNiBnByb3RvMw==")); "ZXN0X2lzc3Vlcy5Gb286B4K1GANiYXJCHaoCGlVuaXRUZXN0Lklzc3Vlcy5U",
"ZXN0UHJvdG9zYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.Extensions.ExtensionsAReflection.Descriptor, global::Google.Protobuf.TestProtos.Extensions.ExtensionsBReflection.Descriptor, }, new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.ExtensionsIssue6936AReflection.Descriptor, global::UnitTest.Issues.TestProtos.ExtensionsIssue6936BReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Extensions.Bar), global::Google.Protobuf.TestProtos.Extensions.Bar.Parser, new[]{ "Foo" }, null, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Bar), global::UnitTest.Issues.TestProtos.Bar.Parser, new[]{ "Foo" }, null, null, null, null)
})); }));
} }
#endregion #endregion
...@@ -46,7 +47,7 @@ namespace Google.Protobuf.TestProtos.Extensions { ...@@ -46,7 +47,7 @@ namespace Google.Protobuf.TestProtos.Extensions {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Protobuf.TestProtos.Extensions.ExtensionsCReflection.Descriptor.MessageTypes[0]; } get { return global::UnitTest.Issues.TestProtos.ExtensionsIssue6936CReflection.Descriptor.MessageTypes[0]; }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
...@@ -74,9 +75,9 @@ namespace Google.Protobuf.TestProtos.Extensions { ...@@ -74,9 +75,9 @@ namespace Google.Protobuf.TestProtos.Extensions {
/// <summary>Field number for the "foo" field.</summary> /// <summary>Field number for the "foo" field.</summary>
public const int FooFieldNumber = 1; public const int FooFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Extensions.Foo foo_; private global::UnitTest.Issues.TestProtos.Foo foo_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public global::Google.Protobuf.TestProtos.Extensions.Foo Foo { public global::UnitTest.Issues.TestProtos.Foo Foo {
get { return foo_; } get { return foo_; }
set { set {
foo_ = value; foo_ = value;
...@@ -145,7 +146,7 @@ namespace Google.Protobuf.TestProtos.Extensions { ...@@ -145,7 +146,7 @@ namespace Google.Protobuf.TestProtos.Extensions {
} }
if (other.foo_ != null) { if (other.foo_ != null) {
if (foo_ == null) { if (foo_ == null) {
Foo = new global::Google.Protobuf.TestProtos.Extensions.Foo(); Foo = new global::UnitTest.Issues.TestProtos.Foo();
} }
Foo.MergeFrom(other.Foo); Foo.MergeFrom(other.Foo);
} }
...@@ -162,7 +163,7 @@ namespace Google.Protobuf.TestProtos.Extensions { ...@@ -162,7 +163,7 @@ namespace Google.Protobuf.TestProtos.Extensions {
break; break;
case 10: { case 10: {
if (foo_ == null) { if (foo_ == null) {
Foo = new global::Google.Protobuf.TestProtos.Extensions.Foo(); Foo = new global::UnitTest.Issues.TestProtos.Foo();
} }
input.ReadMessage(Foo); input.ReadMessage(Foo);
break; break;
......
...@@ -42,7 +42,6 @@ using static UnitTest.Issues.TestProtos.ComplexOptionType2.Types; ...@@ -42,7 +42,6 @@ using static UnitTest.Issues.TestProtos.ComplexOptionType2.Types;
using static UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Extensions; using static UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Extensions;
using static UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types; using static UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types;
using Google.Protobuf.TestProtos; using Google.Protobuf.TestProtos;
using Google.Protobuf.TestProtos.Extensions;
#pragma warning disable CS0618 #pragma warning disable CS0618
...@@ -197,11 +196,11 @@ namespace Google.Protobuf.Test.Reflection ...@@ -197,11 +196,11 @@ namespace Google.Protobuf.Test.Reflection
[Test] [Test]
public void MultipleImportOfSameFileWithExtension() public void MultipleImportOfSameFileWithExtension()
{ {
var descriptor = ExtensionsCReflection.Descriptor; var descriptor = ExtensionsIssue6936CReflection.Descriptor;
var foo = Foo.Descriptor; var foo = Foo.Descriptor;
var bar = Bar.Descriptor; var bar = Bar.Descriptor;
AssertOption("bar", foo.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, foo.GetOption); AssertOption("foo", foo.CustomOptions.TryGetString, ExtensionsIssue6936AExtensions.Opt, foo.GetOption);
AssertOption("foo", bar.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, bar.GetOption); AssertOption("bar", bar.CustomOptions.TryGetString, ExtensionsIssue6936AExtensions.Opt, bar.GetOption);
} }
private void AssertOption<T, D>(T expected, OptionFetcher<T> fetcher, Extension<D, T> extension, Func<Extension<D, T>, T> descriptorOptionFetcher) where D : IExtendableMessage<D> private void AssertOption<T, D>(T expected, OptionFetcher<T> fetcher, Extension<D, T> extension, Func<Extension<D, T>, T> descriptorOptionFetcher) where D : IExtendableMessage<D>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment