pointfreeco/swift-parsing

EXC_BREAKPOINT crash when using ReplaceError parser

russellyeo opened this issue · 0 comments

I have encountered a crash when using replaceError(with:), and can reproduce it using the example documented in the OneOf parser.

enum Currency { case eur, gbp, usd, unknown }

let currency = OneOf {
    "".map { Currency.eur }
    "£".map { Currency.gbp }
    "$".map { Currency.usd }
}
.replaceError(with: Currency.unknown)

print(currency.parse("$")) // Currency.usd
print(currency.parse("฿")) // Thread 1: EXC_BREAKPOINT (code=1, subcode=0x100004650)

Using a SPM executable package on Xcode 15.0.1 (15A507)

I tried stepping through the library code to try see if I could find the root cause, but I think it is beyond my ability/understanding!

Thanks,
Russell