In some cases, using preconditionFailure() instead of precondition(expr) works.
For example, instead of precondition(v), you could try:
if !v { preconditionFailure() }
Simplifying an expression might also help. For example, precondition(a && b) could be rewritten as:
if !a { preconditionFailure() }
if !b { preconditionFailure() }
I guess the optimizer has limitations that prevent Swift 6 code, which compiles in debug builds, from always compiling in release builds.
0 comments