Fixes #1041 and #1038 on linux variants#1048
Fixes #1041 and #1038 on linux variants#1048monomadic wants to merge 2 commits intoSwiftyJSON:masterfrom
Conversation
Compilation fails due to tighter type restrictions on newer swift builds. Casting works and produces no errors.
|
|
||
| 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.
@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