-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix idempotency of roxygenize() for packages using multi-line @rawNamespace #1573
Conversation
Have a (nvm, it doesn't WAI because |
IIRC the idea is that we can't easily tell if But yeah, Your suggested fix makes sense to me. |
Can you please merge/rebase and add a news bullet? |
Done -- still not sure the right approach for testing (as noted, the current test is no good because it actually passes on current One option is to add another test package, I just wonder if you see a way to get the regression test without needing to add a whole fake package. |
What if we just test the assertion that |
Hmm I worry that tests an implementation detail rather than being a regression test for the specific bug. For example, such a test could in the future keep working while due to refactor multi-line Added a minimal test package instead, and confirmed it fails on current |
Co-authored-by: Hadley Wickham <hadley@posit.co>
@MichaelChirico do you think it's worth a patch release for this? |
I see 6 up votes on #1570, so between these two and probably #1575, I would say yes. |
Ok, I'll add to my to do list. |
Closes #1572. NB: This includes #1571, which I used to write the update. I can excise it but leaving it in for now.
Tests still needed. Filing for discussion first on if this is the right approach.
There are two parts to the fix:
namespace_exports()
. This matches the output ofnamespace_imports()
.namespace_imports()
reads in a leading\n
, so we usetrimws()
too.That's all well and good for the example we have in mind for #1572, but I do wonder if the issue is broader. That the
@rawNamespace
entry trips upnamespace_exports()
has a smell to it -- the@rawNamespace
code is only (nested) import directives, why is it being pulled in bynamespace_exports()
? OTOH we probably don't want to traverse the AST for these entries, which can in principle break the dichotomy of import vs. export directives (nothing prevents us from putting anexport()
entry in one branch and animport()
entry in the other, or a mix of the two types in either/both branches). So maybe this is just a case ofnamespace_exports()
being misleadingly named?