-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Finish off the log part of _swift_checkClassAndWarnForKeyedArchiving. #10418
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
Finish off the log part of _swift_checkClassAndWarnForKeyedArchiving. #10418
Conversation
@swift-ci Please test macOS |
@swift-ci Please smoke test Linux |
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 good to me! I think we can improve a bit on the messages though to make them slightly clearer to the average dev:
@"Attempting to <archive/unarchive> <generic> Swift class with mangled name '%@'. This name is unstable and may change in the future, leading to non-decodable data."
@"To avoid this failure, create a concrete subclass..."
@"You can use the 'objc' attribute to ensure that the name will not change..."
@"If there are no existing archives containing this class, you should choose a unique, prefixed name which will not change over time instead: ..."
Will do. Letting the testing finish first to see if I need to pay special attention to the non-macOS platforms. |
@jrose-apple Sounds good! |
Ah, what do you think about the demangled name? I think it has to be printed somewhere because otherwise the user won't know what class is the problem, but it doesn't fit into your version of the error message. |
@jrose-apple Ah, yes. Can we suggest @"Attempting to <archive/unarchive> Swift class '%@' with mangled name '%@'. This name is unstable and may change in the future, leading to non-decodable data."? |
Is it really useful to have the (relatively long) mangled name in the first message? It's going to be printed in the fix-it anyway for non-generic classes. Here's my latest version:
I definitely like including the "leading to non-decodable data" part, as well as your improved follow-up messages. |
@jrose-apple I think so. This warning should be present in the cases where you didn't get the fix-it either, so otherwise, you'd never really know what the mangled name was, only that there was one. (I think especially so, most devs don't know what a "mangled name" is until they see one, and then it's pretty clear what the problem is...) No? If we can fit the mangled name in there somewhere, I think it'll help. Otherwise, this latest iteration on messages is good! |
Hm. The compiler diagnostic specifically avoids the term "mangled", but putting it in here is probably clearer than just saying "runtime name" if it's going to show it. I guess I'll add back the "with mangled runtime name '%@'". |
Logs a warning the first time a problematic class is archived or unarchived. We expect people to actually fix these issues, so the performance of the warning isn't too important. Sample output: [timestamp] Attempting to archive Swift class '_Test.Outer.ArchivedThenUnarchived', which does not have a stable runtime name. [timestamp] Use the 'objc' attribute to ensure that the runtime name will not change: "@objc(_TtCC5_Test5Outer22ArchivedThenUnarchived)" [timestamp] If there are no existing archives containing this class, you can choose a unique, prefixed name instead: "@objc(ABCArchivedThenUnarchived)" Finishes rdar://problem/32414508
922480e
to
7ca3441
Compare
Okay, how's this new version? @swift-ci Please smoke test |
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 — thanks, Jordan!
…swiftlang#10418) Logs a warning the first time a problematic class is archived or unarchived. We expect people to actually fix these issues, so the performance of the warning isn't too important. Sample output: [timestamp] Attempting to archive Swift class '_Test.Outer.ArchivedThenUnarchived', which does not have a stable runtime name. [timestamp] Use the 'objc' attribute to ensure that the runtime name will not change: "@objc(_TtCC5_Test5Outer22ArchivedThenUnarchived)" [timestamp] If there are no existing archives containing this class, you can choose a unique, prefixed name instead: "@objc(ABCArchivedThenUnarchived)" Finishes rdar://problem/32414508
Logs a warning the first time a problematic class is archived or unarchived. We expect people to actually fix these issues, so the performance of the warning isn't too important.
Sample output:
Finishes rdar://problem/32414508