diff --git a/stdlib/core/ArrayBuffer.swift b/stdlib/core/ArrayBuffer.swift index b83f9e985d5..abd24c79dc0 100644 --- a/stdlib/core/ArrayBuffer.swift +++ b/stdlib/core/ArrayBuffer.swift @@ -210,7 +210,7 @@ extension ArrayBuffer { // Could be sped up, e.g. by using // enumerateObjectsAtIndexes:options:usingBlock: for i in subRange { - assert(ns.objectAtIndex(i) is T, + _precondition(ns.objectAtIndex(i) is T, "NSArray element failed to match the Swift Array Element type") } } diff --git a/stdlib/core/FixedPoint.swift.gyb b/stdlib/core/FixedPoint.swift.gyb index bf3edd4ccc4..7e3cefadec4 100644 --- a/stdlib/core/FixedPoint.swift.gyb +++ b/stdlib/core/FixedPoint.swift.gyb @@ -375,9 +375,11 @@ func ${op} (lhs: ${Self}, rhs: ${Self}) -> Bool { @transparent func ${op} (lhs: ${Self}, rhs: ${Self}) -> ${Self} { % if signed: - assert(U${Self}(rhs) < U${Self}(sizeofValue(rhs) * 8)) + _precondition(U${Self}(rhs) < U${Self}(sizeofValue(rhs) * 8), + "shift amount is larger than type size in bits") % else: - assert(rhs < ${Self}(sizeofValue(rhs) * 8)) + _precondition(rhs < ${Self}(sizeofValue(rhs) * 8), + "shift amount is larger than type size in bits") % end return ${Self}(Builtin.${name}_${BuiltinName}(lhs.value, rhs.value)) } diff --git a/stdlib/core/FloatingPoint.swift.gyb b/stdlib/core/FloatingPoint.swift.gyb index d166c6b7d8c..92e09fb9d91 100644 --- a/stdlib/core/FloatingPoint.swift.gyb +++ b/stdlib/core/FloatingPoint.swift.gyb @@ -483,8 +483,10 @@ extension ${Self} { % for srcBits in allFloatBits: % That = floatName(srcBits) init(_ v: ${That}) { - assert(v >= ${That}(${Self}.min)) - assert(v <= ${That}(${Self}.max)) + _precondition(v >= ${That}(${Self}.min), + "floating point value can not be converted to ${Self} because it is greater than ${Self}.min") + _precondition(v <= ${That}(${Self}.max), + "floating point value can not be converted to ${Self} because it is less than ${Self}.min") value = Builtin.fpto${sign}i_FPIEEE${srcBits}_${BuiltinName}(v.value) } % end diff --git a/test/stdlib/FloatingPointConversionOverflow.swift b/test/stdlib/FloatingPointConversionOverflow.swift index a73a5c962d5..c1e41791f2b 100644 --- a/test/stdlib/FloatingPointConversionOverflow.swift +++ b/test/stdlib/FloatingPointConversionOverflow.swift @@ -91,7 +91,7 @@ case "32": let x = Int64(pf) default: break } -// CHECK: assertion failed: file {{.*}}/FloatingPoint.swift, line {{[0-9]*}} +// CHECK: fatal error: floating point value can not be converted // CHECK-NEXT: CRASHED: SIG{{ILL|TRAP}} println("BUSTED: should have crashed already") exit(1)