-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[move-compiler] Remove WarningFiltersScope from CompilationEnv #20065
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
external-crates/move/crates/move-compiler/src/naming/translate.rs
Outdated
Show resolved
Hide resolved
pub fn add_diag(&self, diag: Diagnostic) { | ||
self.env.add_diag(&self.warning_filters_scope, diag); | ||
} | ||
|
||
#[allow(unused)] | ||
pub fn add_diags(&self, diags: Diagnostics) { | ||
self.env.add_diags(&self.warning_filters_scope, diags); | ||
} | ||
|
||
pub fn add_warning_filter_scope(&mut self, filters: WarningFilters) { | ||
self.warning_filters_scope.push(filters) | ||
} | ||
|
||
pub fn pop_warning_filter_scope(&mut self) { | ||
self.warning_filters_scope.pop() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of repeating this pattern several places, what about something like:
struct DiagnosticReporter {
diags: Arc<RwLock<Diagnostics>>,
warning_filters: ...
}
impl DiagnosticReporter {
pub fn add_diag(&self, diag: Diagnostic) {
self.env.add_diag(&self.warning_filters_scope, diag);
}
#[allow(unused)]
pub fn add_diags(&self, diags: Diagnostics) {
self.env.add_diags(&self.warning_filters_scope, diags);
}
pub fn add_warning_filter_scope(&mut self, filters: WarningFilters) {
self.warning_filters_scope.push(filters)
}
pub fn pop_warning_filter_scope(&mut self) {
self.warning_filters_scope.pop()
}
}
And tne for the env:
impl CompilationEnv {
fn diag_reporter() -> {
DiagnosticReporter {
diags: Arc::clone(self.diags),
warning_filters: self.top_level_warning_filter_scope().clone(),
}
}
}
Then we can hold/reuse this in local scopes, easing the pressure of the rewrite and simplifying some of the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make some progress on this offline. I think it would make this large PR a bit too large.
I'm fine making iterative progress here, even if eventually this entire PR is undone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo hemming and hawwing over the general approach.
## Description - Followup to #20065 - Better encapsulates warning filter scopes with diagnostic reporting ## Test plan - ran tests --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
## Description - Followup to #20065 - Better encapsulates warning filter scopes with diagnostic reporting ## Test plan - ran tests --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
Description
Test plan
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.