-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Diag] Create frontend flags for localization and write tests #32568
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
Conversation
@LucianoPAlmeida in #32483 you were suggesting using an assertion rather than an |
@HassanElDesouky I can just on that an tell you why - since it's expected that locale and path are always there when |
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.
Overall looks great! Let's get comments I have left inline addressed and this would be ready to merge.
Exactly how @xedin said :) |
test/diagnostics/Localization/no_localization_files_and_wrong_path.swift
Outdated
Show resolved
Hide resolved
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.
Everything is coming along now! I have left just a couple of comments inline and once addressed we should be ready!
917d4e5
to
d9789d9
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.
LGTM!
@swift-ci please test |
Build failed |
Build failed |
I'm going to need to revert this. The driver is double faulting on my Linux box (Fedora 32 / x86-64). It crashes due to heap corruption, then hangs trying to introspect and print the stack. There also appears to be an unrelated(?) uninitialized memory error that valgrind detects (as opposed to malloc's own self diagnostics):
That being said, if I bypass the driver, it works. |
…swiftlang#32568)" This reverts commit 621b3b4. The driver is double faulting on my Linux box (Fedora 32 / x86-64). It crashes due to heap corruption, then hangs trying to introspect and print the stack. There also appears to be an unrelated(?) uninitialized memory error that valgrind detects (as opposed to malloc's own self diagnostics).
|
||
Diags.diagnose(SourceLoc(), diag::error_invalid_locale_code, | ||
availableLocaleCodes); | ||
return true; |
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.
This should not return after erroring. It should just ignore the bogus -locale
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!
In the last PR #32483, I introduced localization support for diagnostics via file-per-language store in
YAML
format.In this PR I'm introducing the following:
-locale
compiler frontend flag for choosing the language.-localization-path
compiler frontend flag to provide a path for the YAML files (to use in testing).The tests handle these cases:
-localization-path
is incorrect i.e. the directory is missing theYAML
files. We won't crash the compiler but instead, we should fall back to the default messages from the current.def
files.<lang>.yaml
doesn't have a translation for a particular diagnostic message it should fall back to the English message found in.def
files.In the future PRs, I should handle lint tools for
YAML
files and prune tools to prune the diagnostics that gets removed from.def
files.cc @xedin