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

check for namespace shadowing #126

Merged
merged 3 commits into from
Sep 2, 2024

Conversation

tardyp
Copy link
Contributor

@tardyp tardyp commented Aug 26, 2024

protoc enforces that the name space resolution stops when it found a relative name which starts with a package fragment contained by the current package

e.g:
if package is com.foo
The type foo.Bar relative name resolution will never reach root path, it will stop searching at com.foo.Bar

The reasoning for this behavior I think is to avoid to have the resolution working at a certain point of time, and later somebody defines com.foo.Bar, and then your type is suddently pointing to somewhere else.
This is why I called it shadowing.

a test in protox is created in andrewhickman/protox#84

todo:

  • test with this package test framework

Fix: andrewhickman/protox#82

@andrewhickman
Copy link
Owner

Awesome, thanks for the fix. Looks like a couple of tests are failing but the change looks good to me

@tardyp tardyp force-pushed the name_resolution branch 2 times, most recently from dec7b71 to ffd091a Compare September 2, 2024 19:14
Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 65.11628% with 15 lines in your changes missing coverage. Please review.

Project coverage is 76.24%. Comparing base (4a6dd64) to head (293acbb).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
prost-reflect/src/descriptor/build/mod.rs 68.57% 11 Missing ⚠️
prost-reflect/src/descriptor/error.rs 50.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #126      +/-   ##
==========================================
- Coverage   76.59%   76.24%   -0.35%     
==========================================
  Files          31       31              
  Lines        5426     5456      +30     
==========================================
+ Hits         4156     4160       +4     
- Misses       1270     1296      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

protoc enforces that the name space resolution stops when it found a relative name
which starts with a package fragment contained by the current package

e.g:
if package is com.foo
The type foo.Bar relative name resolution will never reach root path, it will stop searching at com.foo.Bar
we change the test as this is not a proper case
@tardyp
Copy link
Contributor Author

tardyp commented Sep 2, 2024

I think the workflow should pass entirely now. For some reason, github auto-approved a few of my attempts, but not the latest one.

@andrewhickman andrewhickman merged commit 07dd3e5 into andrewhickman:main Sep 2, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

package resolution of protox is less strict than protoc
2 participants