-
Notifications
You must be signed in to change notification settings - Fork 1k
[Merged by Bors] - feat(translate): linter for overwriting existing translations #33777
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 by Bors] - feat(translate): linter for overwriting existing translations #33777
Conversation
PR summary 21cf59b03bImport changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diffNo declarations were harmed in the making of this PR! 🐙 You can run this locally as follows## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for No changes to technical debt.You can run this locally as
|
|
This pull request has conflicts, please merge |
| if tgt != tgt' then | ||
| Linter.logLintIf linter.translateOverwrite ref | ||
| m!"`{src}` was already translated to `{tgt'}` instead of `{tgt}`.\n\ | ||
| Unless the original translation was wrong, please remove this `{t.attrName}` attribute." |
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.
We don't have a test that shows this new warning in action, right?
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.
I've added one now
bryangingechen
left a comment
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.
Thanks!
bors r+
This PR refactors the linter in `to_dual`/`to_additive` for when you tag a declaration that already has a translation. Previously it threw an error that couldn't be turned off, and it would only do this when using the `existing` modifier. Now it also runs without the `existing` modifier, and it only throws a warning, which can also be turned off. There was some hard coded stuff for allowing to correct the `(reorder := ...)` argument. I removed this code, which also has the side effect of making the syntax more consistent. In order to stay compatible with these cases, the linter doesn't complain when setting the translation to the same thing again. See also #1779 which allowed `to_additive` on already existing translations
|
Pull request successfully merged into master. Build succeeded: |
…over-community#33777) This PR refactors the linter in `to_dual`/`to_additive` for when you tag a declaration that already has a translation. Previously it threw an error that couldn't be turned off, and it would only do this when using the `existing` modifier. Now it also runs without the `existing` modifier, and it only throws a warning, which can also be turned off. There was some hard coded stuff for allowing to correct the `(reorder := ...)` argument. I removed this code, which also has the side effect of making the syntax more consistent. In order to stay compatible with these cases, the linter doesn't complain when setting the translation to the same thing again. See also leanprover-community#1779 which allowed `to_additive` on already existing translations
…over-community#33777) This PR refactors the linter in `to_dual`/`to_additive` for when you tag a declaration that already has a translation. Previously it threw an error that couldn't be turned off, and it would only do this when using the `existing` modifier. Now it also runs without the `existing` modifier, and it only throws a warning, which can also be turned off. There was some hard coded stuff for allowing to correct the `(reorder := ...)` argument. I removed this code, which also has the side effect of making the syntax more consistent. In order to stay compatible with these cases, the linter doesn't complain when setting the translation to the same thing again. See also leanprover-community#1779 which allowed `to_additive` on already existing translations
This PR refactors the linter in
to_dual/to_additivefor when you tag a declaration that already has a translation. Previously it threw an error that couldn't be turned off, and it would only do this when using theexistingmodifier. Now it also runs without theexistingmodifier, and it only throws a warning, which can also be turned off.There was some hard coded stuff for allowing to correct the
(reorder := ...)argument. I removed this code, which also has the side effect of making the syntax more consistent. In order to stay compatible with these cases, the linter doesn't complain when setting the translation to the same thing again.See also #1779 which allowed
to_additiveon already existing translations