Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scope resolution for Google namespace #5878

Merged
merged 1 commit into from Jun 25, 2019

Conversation

Parad0X
Copy link
Contributor

@Parad0X Parad0X commented Mar 12, 2019

Second stab at #4167

Having google in the package namespace generates unusable ruby code.

syntax = "proto3";

package foo.vendor.google;

message Bar {
  int32 baz = 1;
}
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: test.proto

require 'google/protobuf'

Google::Protobuf::DescriptorPool.generated_pool.build do
  add_message "foo.vendor.google.Bar" do
    optional :baz, :int32, 1
  end
end

module Foo
  module Vendor
    module Google
      Bar = Google::Protobuf::DescriptorPool.generated_pool.lookup("foo.vendor.google.Bar").msgclass
    end
  end
end

which obviously doesn't work:

<module:Google>: uninitialized constant Foo::Vendor::Google::Protobuf (NameError)

Google::Protobuf::DescriptorPool must be prefixed with :: to fix this.

@Parad0X
Copy link
Contributor Author

Parad0X commented Mar 12, 2019

@xfxyjwf @haberman ping since you guys approved #4167 :)

@Parad0X
Copy link
Contributor Author

Parad0X commented Mar 18, 2019

@haberman tests fixed

@Parad0X
Copy link
Contributor Author

Parad0X commented May 15, 2019

@haberman ping

@haberman haberman merged commit 5bc250b into protocolbuffers:master Jun 25, 2019
bithium pushed a commit to bithium/protobuf that referenced this pull request Sep 4, 2023
Fix scope resolution for Google namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants