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

Unreferenced public imports are stripped #207

Closed
tgolsson opened this issue Dec 8, 2020 · 2 comments
Closed

Unreferenced public imports are stripped #207

tgolsson opened this issue Dec 8, 2020 · 2 comments
Labels
bug Something isn't working compiler Issues related to the compiler.

Comments

@tgolsson
Copy link
Contributor

tgolsson commented Dec 8, 2020

e.g,

pub use other_file::do_something;

pub fn main() {
     do_something; // this line does nothing but if you remove it `do_something` won't be externally visible.
}

This requires one to create bogus references to all public functions; as in https://github.com/tgolsson/aoc-2020/blob/main/scripts/main.rn#L11.

I've noticed similar issues with module-private functions being marked as unused if the main function isn't called main, e.g.,
https://github.com/tgolsson/aoc-2020/blob/main/scripts/day1.rn#L3 filter_inner is marked as unused by the LSP.

@tgolsson tgolsson added bug Something isn't working compiler Issues related to the compiler. labels Dec 8, 2020
@tgolsson
Copy link
Contributor Author

@udoprog I'm happy with after your improvements, do you feel more work is needed or shall we close this? :-)

@udoprog
Copy link
Collaborator

udoprog commented Dec 15, 2020

Ah, yeah, this can be closed. Thanks!

@udoprog udoprog closed this as completed Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler Issues related to the compiler.
Projects
None yet
Development

No branches or pull requests

2 participants