-
Notifications
You must be signed in to change notification settings - Fork 550
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
Use Star Edition filter #6742
Use Star Edition filter #6742
Conversation
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.
Reviewed 2 of 3 files at r1.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @Tomer-StarkWare)
crates/cairo-lang-semantic/src/diagnostic.rs
line 541 at r1 (raw file):
format!( "Global `use` item is not supported in {} edition.", edition.prelude_submodule_name()
Suggestion:
format!("Global `use` item is not supported in `{:edition?}` edition.")
crates/cairo-lang-semantic/src/items/module.rs
line 132 at r1 (raw file):
SemanticDiagnosticKind::GlobalUsesNotSupportedInEdition(edition), ); }
move the diagnostic to glob-use
item.
Code quote:
let edition = db
.crate_config(module_id.owning_crate(db.upcast()))
.map(|cfg| cfg.settings.edition)
.unwrap_or_default();
let allow_global_uses = !edition.ignore_visibility();
let global_uses = db
.module_global_uses(module_id)?
.iter()
.map(|(global_use_id, use_path_star)| {
let item = ast::UsePath::Star(use_path_star.clone()).get_item(syntax_db);
let visibility = item.visibility(syntax_db);
if !allow_global_uses {
diagnostics.report(
use_path_star,
SemanticDiagnosticKind::GlobalUsesNotSupportedInEdition(edition),
);
}
578b4d8
to
82fd936
Compare
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.
Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @orizi)
crates/cairo-lang-semantic/src/items/module.rs
line 132 at r1 (raw file):
Previously, orizi wrote…
move the diagnostic to
glob-use
item.
Done.
crates/cairo-lang-semantic/src/diagnostic.rs
line 541 at r1 (raw file):
format!( "Global `use` item is not supported in {} edition.", edition.prelude_submodule_name()
Done.
82fd936
to
aac5146
Compare
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.
Reviewed 4 of 4 files at r2.
Reviewable status: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware and @Tomer-StarkWare)
crates/cairo-lang-semantic/src/items/us.rs
line 191 at r2 (raw file):
)); return Ok(UseGlobalData { diagnostics: diagnostics.build(), imported_module }); }
Suggestion:
let star_ast = db.module_global_use_by_id(global_use_id)?.to_maybe()?;
let mut resolver = Resolver::new(db, module_file_id, inference_id);
let edition = resolver.settings.edition;
if edition.ignore_visibility() {
let imported_module = Err(diagnostics.report(
&star_ast,
SemanticDiagnosticKind::GlobalUsesNotSupportedInEdition(edition),
));
return Ok(UseGlobalData { diagnostics: diagnostics.build(), imported_module });
}
aac5146
to
6a9d90e
Compare
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.
Reviewable status: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware and @orizi)
crates/cairo-lang-semantic/src/items/us.rs
line 191 at r2 (raw file):
)); return Ok(UseGlobalData { diagnostics: diagnostics.build(), imported_module }); }
Done.
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.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware and @Tomer-StarkWare)
crates/cairo-lang-semantic/src/items/us.rs
line 188 at r4 (raw file):
Err(diagnostics.report(&star_ast, GlobalUsesNotSupportedInEdition(edition))); return Ok(UseGlobalData { diagnostics: diagnostics.build(), imported_module }); }
don't break everything in that case - just add to diagnostics.
Suggestion:
if edition.ignore_visibility() {
// We block support for global use where visibility is ignored.
diagnostics.report(&star_ast, GlobalUsesNotSupportedInEdition(edition));
}
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware and @orizi)
crates/cairo-lang-semantic/src/items/us.rs
line 188 at r4 (raw file):
Previously, orizi wrote…
don't break everything in that case - just add to diagnostics.
Done.
6a9d90e
to
91a75d0
Compare
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.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @gilbens-starkware)
No description provided.