8000 Don't suggest an export if it's a modularity error to use that package by neilparikh · Pull Request #8835 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Don't suggest an export if it's a modularity error to use that package #8835

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

Merged
merged 5 commits into from
May 8, 2025

Conversation

neilparikh
Copy link
Collaborator

Replicates what we do for imports for exports.

Review commit-by-commit.

Motivation

Don't give an autocorrect that's incorrect.

Test plan

See included automated tests.

@neilparikh neilparikh force-pushed the neil-no-export-if-violation branch from 8d4c5c1 to f1a0eb8 Compare May 6, 2025 19:01
@@ -468,8 +432,34 @@ class VisibilityCheckerPass final {
path.has_value();
}
if (!causesCycle && !layeringViolation && !strictDependenciesTooLow) {
if (wasNotImported) {
// We failed to import the package that defines the symbol
if (!isExported) {
Copy link
Collaborator Author
@neilparikh neilparikh May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, !isExported and !wasImported are treated as exclusive, but it's actually possible for both to be true. In a future PR, I'll handle the !isExported && !wasImported case.

@neilparikh neilparikh marked this pull request as ready for review May 6, 2025 19:07
@neilparikh neilparikh requested a review from a team as a code owner May 6, 2025 19:07
@neilparikh neilparikh requested review from froydnj and removed request for a team May 6, 2025 19:07
Comment on lines +495 to +497
if (!db.errorHint().empty()) {
e.addErrorNote("{}", db.errorHint());
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We typically put the addErrorNote last, would you mind moving it for consistency?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, moved the addErrorLine call up.

@@ -4,13 +4,9 @@
#include "absl/synchronization/blocking_counter.h"
#include "ast/treemap/treemap.h"
#include "common/concurrency/ConcurrentQueue.h"
#include "common/sort/sort.h"
#include "common/strings/formatting.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooc, were these includes in service of assorted rbi-gen stuff? or do you think they became unused before we deleted the rbi-gen stuff?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably before the rbi-gen stuff. For example, this commit got rid of the call to fast_sort. I assume something similar for the other includes.

@neilparikh neilparikh force-pushed the neil-no-export-if-violation branch from a1b2e1b to f502624 Compare May 7, 2025 21:00
@neilparikh neilparikh merged commit 13da8c9 into master May 8, 2025
14 checks passed
@neilparikh neilparikh deleted the neil-no-export-if-violation branch May 8, 2025 21:16
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.

2 participants
0