Hatchet News

Using precondition(e) in a release build sometimes does not compile.

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.

designed and developed by Tommy Chow (source)