-
Notifications
You must be signed in to change notification settings - Fork 10.6k
SIL: make a linkage mismatch during de-serialization a human readable diagnostic #85628
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
base: main
Are you sure you want to change the base?
Conversation
|
@swift-ci smoke test |
slavapestov
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.
I won't insist on a test case since I'm assuming it's too much of a pain in the ass, but if it's at all possible...
include/swift/AST/DiagnosticsSIL.def
Outdated
| (StringRef, Type, Type)) | ||
|
|
||
| ERROR(deserialize_function_linkage_mismatch,Fatal, | ||
| "linkage mismatch of function '%0', declared as %1but expected as %2", |
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 think you want to add a space between then %1 and but
lib/SIL/IR/SILPrinter.cpp
Outdated
| static StringRef getLinkageString(SILLinkage linkage) { | ||
| StringRef swift::getLinkageString(SILLinkage linkage) { | ||
| switch (linkage) { | ||
| case SILLinkage::Public: return "public "; |
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.
Ok I see, this already has a space at the end, but that's really weird, can you please change it to not do that? There is only one caller of getLinkageString(), and it's printLinkage(), which could easily be changed to print the space.
|
Thanks for improving this erik! :D |
… diagnostic Although this error can only happen when tinkering with the stdlib's runtime functions, it's nice to get a readable error message. So far, the compiler just crashed later without a hint to the original problem.
c2545ad to
9d02917
Compare
|
@swift-ci smoke test |
|
Thank you for addressing the review feedback! LGTM. |
Although this error can only happen when tinkering with the stdlib's runtime functions, it's nice to get a readable error message. So far, the compiler just crashed later without a hint to the original problem.