mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Don't verify exact NaN text for .debugDescription (#33391)
This specific check has never worked on all processors (because some FP HW mangles NaNs) and recent LLVM changes have broken it on the remaining platforms. Resolves SR-13354
This commit is contained in:
@@ -442,21 +442,20 @@ fileprivate func expectNaN<T>(_ expected: String, _ object: T,
|
|||||||
message(),
|
message(),
|
||||||
stackTrace: stackTrace.pushIf(showFrame, file: file, line: line))
|
stackTrace: stackTrace.pushIf(showFrame, file: file, line: line))
|
||||||
|
|
||||||
// debugDescription prints full details about NaNs, which is tricky to test
|
// debugDescription tries to print details about NaNs, which is tricky to test.
|
||||||
// because NaNs often get truncated: various implementations force all NaNs
|
|
||||||
// quiet, discard payloads, or clear sign bits. In some cases, just passing a
|
|
||||||
// NaN into a function (via an FP register) is enough to mangle the value.
|
|
||||||
|
|
||||||
#if arch(x86_64)
|
/*
|
||||||
// Verify the exact debugDescription value only on x86_64, where we
|
// We cannot reliably test the exact expected string, because various
|
||||||
// know the exact expected String:
|
// implementations force all NaNs quiet, discard payloads, or clear sign bits.
|
||||||
|
// In some cases, just passing a NaN into a function (via an FP register) is
|
||||||
|
// enough to mangle the value.
|
||||||
expectEqual(expected, object.debugDescription,
|
expectEqual(expected, object.debugDescription,
|
||||||
message(),
|
message(),
|
||||||
stackTrace: stackTrace.pushIf(showFrame, file: file, line: line))
|
stackTrace: stackTrace.pushIf(showFrame, file: file, line: line))
|
||||||
#endif
|
*/
|
||||||
|
|
||||||
// On all platforms, we verify that the generated debugDescription text
|
// We can verify that the generated debugDescription text
|
||||||
// follows the expected format, even when we can't verify the exact value.
|
// follows the expected general format, even when we can't verify the exact value.
|
||||||
var actual = object.debugDescription
|
var actual = object.debugDescription
|
||||||
|
|
||||||
// Optional leading "-"
|
// Optional leading "-"
|
||||||
|
|||||||
Reference in New Issue
Block a user