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
Fixes #1041 and #1038 on linux variants #1048
base: master
Are you sure you want to change the base?
Conversation
Compilation fails due to tighter type restrictions on newer swift builds. Casting works and produces no errors.
Source/SwiftyJSON/SwiftyJSON.swift
Outdated
@@ -1212,7 +1212,7 @@ public func > (lhs: JSON, rhs: JSON) -> Bool { | |||
public func < (lhs: JSON, rhs: JSON) -> Bool { | |||
|
|||
switch (lhs.type, rhs.type) { | |||
case (.number, .number): return lhs.rawNumber < rhs.rawNumber | |||
case (.number, .number): return lhs.rawNumber as NSNumber > rhs.rawNumber as NSNumber |
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.
@deathdisco Shouldn't this be <
(instead of >
)?
(Should explain for the failing tests 😉 )
fixed lhs greater-than comparison to reflect correct comparison operator
Any movement here? I'm developing a cross-platform library that depends on SwiftyJSON and having this fixed would be a huge benefit! |
@monomadic This isn't compiling (at least on a mac). I think the Swift compiler thinks
on Travis CI here. You need to put brackets around the left side of case (.number, .number): return (lhs.rawNumber as NSNumber) < rhs.rawNumber as NSNumber
^^^^^^^^^^^^^^^^^^^^^^^^^^^ Need brackets |
After applying that fix on a local checkout of this branch under Ubuntu 18.04 in WSL 2, it still doesn't work. I've changed the line to: case (.number, .number): return (lhs.rawNumber as NSNumber) < (rhs.rawNumber as NSNumber) When adding the local copy as a dependency of another project and running
It seems there's a deeper issue that this PR doesn't address at all. Is it possible that this is a bug in the Linux implementation of Foundation? |
@Geo1088 Yeah, you're right. Sorry jumped the gun a bit. The quick fix might be to rename the operators like this. |
Consider #1083 instead. |
Any update on this? Seeing this error still |
Compilation fails due to tighter type restrictions on newer swift builds. Casting works and produces no errors. See #1041 and #1038 for complaints on this issue.
Unnecessary, existing tests cover this case (it is purely a type definition in two places)
Not needed
No
No