-
Notifications
You must be signed in to change notification settings - Fork 29
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
Sort Properties After Creation #175
base: main
Are you sure you want to change the base?
Sort Properties After Creation #175
Conversation
Interesting, the tests' type checker couldn't do that inference, I think due to Edit: Edit edit: Minimal Examplelet handleWarningAsError = false
func handle<T>(warning: String) -> T? {
if handleWarningAsError {
fatalError()
} else {
print(warning)
return nil
}
}
let keys = ["foo", "bar"]
struct Property {
let name: String
let uuid = UUID()
}
let properties = keys.compactMap { key in // Error: ambiguous, fix with [Property]
if key == "foo" {
return handle(warning: "You are foo, I don't like you")
}
return Property(name: key)
}
print(properties) |
@liamnichols I apologize for the ping, could this and #177 receive a review as I would like to go ahead with some work that would use these features. Thank you! |
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.
Hi @LePips, really sorry about the delay in getting though these notifications! Thanks for taking the time to work on this, I really appreciate it!
The changes looks good to me assuming that it is doing what you say it does, but could you maybe replicate it in the tests somehow so that we can be sure not to break the behaviour in the future by mistake? 🙏
useSwiftyPropertyNames
andsortPropertiesAlphabetically
ordering #174Sorts created properties, which go through their own independent renamings if applicable, instead of the raw keys.