diff --git a/ruby/tests/generated_code.proto b/ruby/tests/generated_code.proto index 3b934bd69..e8116697d 100644 --- a/ruby/tests/generated_code.proto +++ b/ruby/tests/generated_code.proto @@ -69,6 +69,11 @@ enum TestEnum { C = 3; } +message testLowercaseNested { + message lowercase{} +} + + message TestUnknown { TestUnknown optional_unknown = 11; repeated TestUnknown repeated_unknown = 31; diff --git a/ruby/tests/generated_code_test.rb b/ruby/tests/generated_code_test.rb index 6e6f915ad..aed1cf8eb 100644 --- a/ruby/tests/generated_code_test.rb +++ b/ruby/tests/generated_code_test.rb @@ -15,6 +15,8 @@ class GeneratedCodeTest < Test::Unit::TestCase # successfully creates message definitions and classes, not to test every # aspect of the extension (basic.rb is for that). A::B::C::TestMessage.new + A::B::C::TestMessage::NestedMessage.new + A::B::C::TestLowercaseNested::Lowercase.new FooBar::TestImportedMessage.new A::B::TestRubyPackageMessage.new end diff --git a/src/google/protobuf/compiler/ruby/ruby_generator.cc b/src/google/protobuf/compiler/ruby/ruby_generator.cc index 6b9ea8226..d6aa1f008 100644 --- a/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ b/src/google/protobuf/compiler/ruby/ruby_generator.cc @@ -389,7 +389,7 @@ void GenerateMessageAssignment( "lookup(\"$full_name$\").msgclass\n", "full_name", message->full_name()); - std::string nested_prefix = prefix + message->name() + "::"; + std::string nested_prefix = prefix + RubifyConstant(message->name()) + "::"; for (int i = 0; i < message->nested_type_count(); i++) { GenerateMessageAssignment(nested_prefix, message->nested_type(i), printer); }