Closed nighthawk closed 2 years ago
Screenshot of the crash in Xcode, in case it helps.
Looks like a Swift 5.6 regression. I'll investigate.
@nighthawk is the crash affecting your project, or just the test failure? If it's only the latter I can just disable the test for now.
As far as I can tell, it doesn't seem to be impacting my project; just running the tests crashed.
I commented out these tests temporarily:
testTooFewArgumentsWithAdvancedInitializer
testTooFewArgumentsForCustomFunctionWithAdvancedInitializer
testTooManyArgumentsWithAdvancedInitializer
testUnknownSymbolWithAdvancedInitializer
@nicklockwood .. Seems following line is causing the issue (Expression.swift: line 354)
if let fn = pureSymbols($0) ?? Expression.mathSymbols[$0] ?? Expression.boolSymbols[$0] {
return fn
}
Haven't figured out the exact cause yet, but looks like there is an issue where there is cascaded nil-coalescing operation.
In one of the failing test, the fn
evaluates to non-nil even when all 3 expressions are nil. Consequently, when it tries to execute line 892 (where crash is happening), it tries to execute the nil function and that's why the EXEC_BAD_ACCESS
.
Adding brackets to first two correctly evaluated fn to be nil solves the crash.
if let fn = (pureSymbols($0) ?? Expression.mathSymbols[$0]) ?? Expression.boolSymbols[$0] {
return fn
}
You can add this workaround temporarily.
@bhimsenp thanks, that solved it!
@nighthawk fixed in 0.13.6
Running this repo's test suite on macOS 12.3 with Xcode 13.3 and Swift 5.6 crashes on my M1 MacBook Air with an
EXC_BAD_ACCESS
.This happens in tests such as
testTooFewArgumentsForCustomFunctionWithAdvancedInitializer
and a number of other ones which test a mismatching number of arguments.I couldn't yet narrow down what might be causing it and if it's an issue introduced with Swift 5.6 or with this library, or what to do about it. It happens both when running through Xcode or with
swift test
from the command line. Any advise appreciated!