pointfreeco/swift-parsing

Floating point parsers not working on macOS Catalina

maximkrouk opened this issue · 6 comments

I'll just leave the use case, it should probably be enough to reproduce the issue

.package(..., from: "0.1.1")
let output = Parsers.StartsWith("v")
    .skip(Many(StartsWith(" ")))
    .take(Int.parser())
    .parse("v  1.0")
print(output) // Optional(1) ✅
let output = Parsers.StartsWith("v")
    .skip(Many(StartsWith(" ")))
    .take(Float.parser())
    .parse("v  1.0")
print(output) // nil 🚫
print(Float.parser().parse("1.0")) // nil 🚫

Double doesn't work as well

@maximkrouk I can't seem to reproduce this. When I add the following assertion to our test suite, it passes:

XCTAssertEqual(
  Parsers.StartsWith("v")
    .skip(Many(StartsWith(" ")))
    .take(Float.parser())
    .parse("v  1.0"),
  1.0
)

Any chance you can try submitting a failing PR?

Does the CI workflow use macOS Catalina for tests? iOS works fine btw, so I'm not sure if I'm able to make a failing PR 🌚

CI is on Catalina. I ran locally on Big Sur and it's working fine.

Well, it's fixed on main, so I'm closing the issue.
But the current 0.1.1 version fails anyway (you can just checkout this version on your local device and double tests will fail), probably it's just a time for a new release 😅

.package(url: "...", .branch("main")) is a temporary solution for those, who face this issue before the next release.

@maximkrouk That's really weird. We changed the Double parsing strategy, so it makes sense that they could differ, but I ran the above assertion against the 0.1.1 tag. We'll cut 0.1.2 soon!

FWIW I also ran into this, and can confirm it's fixed in 0.1.2.