-
-
Notifications
You must be signed in to change notification settings - Fork 827
Warn when top-level definition shadows imported value #4672
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
The head ref may contain hidden characters: "shadow\u2010import\u2010warning"
Conversation
31ecdd8
to
183f2e3
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.
Nice, thank you! I've left some notes inline 🙏
Could you update the changelog too please
compiler-core/src/analyse.rs
Outdated
location: c.location, | ||
name: name.clone(), | ||
}); | ||
} |
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.
Can we move this and the other instance of this block below into a helper method on self
please 🙏
compiler-core/src/warning.rs
Outdated
name | ||
} => Diagnostic { | ||
title: format!("`{}` shadows an imported name", name), | ||
text: format!("Definition of `{}` shadows an imported value.\n\ |
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.
Use the wrap function please 🙏
"thepackage", | ||
"module", | ||
r#" | ||
pub const foo = 1 |
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.
No foobar please, it's a rather grim WW2 reference.
183f2e3
to
a3dc304
Compare
Hi. I have updated the PR. |
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.
Thank you!!
Added Warning::TopLevelDefinitionShadowsImport with tests and snapshots
a3dc304
to
fbbd1e9
Compare
Added Warning::TopLevelDefinitionShadowsImport with tests and snapshots
Closes #4666
This PR adds a compiler warning when a top-level function/constant shadows an imported value: