Skip to content

Commit edba71c

Browse files
committed
Revert "SR-1464: Add NSDecimalNumber.description"
This reverts commit a8de83b. See discussion in #1929 for details.
1 parent 59de3bc commit edba71c

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

Foundation/NSDecimalNumber.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,7 @@ open class NSDecimalNumber : NSNumber {
147147
public required convenience init(bytes buffer: UnsafeRawPointer, objCType type: UnsafePointer<Int8>) {
148148
NSRequiresConcreteImplementation()
149149
}
150-
151-
open override var description: String {
152-
return self.decimal.description
153-
}
154-
150+
155151
open override func description(withLocale locale: Locale?) -> String {
156152
guard locale == nil else {
157153
fatalError("Locale not supported: \(locale!)")

TestFoundation/TestDecimal.swift

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ class TestDecimal: XCTestCase {
504504
XCTAssertEqual(1, ten._length)
505505
}
506506

507-
func test_NSDecimal() throws {
507+
func test_NSDecimal() {
508508
var nan = Decimal.nan
509509
XCTAssertTrue(NSDecimalIsNotANumber(&nan))
510510
var zero = Decimal()
@@ -525,31 +525,6 @@ class TestDecimal: XCTestCase {
525525
let nsd1 = NSDecimalNumber(decimal: Decimal(2657.6))
526526
let nsd2 = NSDecimalNumber(floatLiteral: 2657.6)
527527
XCTAssertEqual(nsd1, nsd2)
528-
529-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(Int8.min)).description, Int8.min.description)
530-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(Int8.max)).description, Int8.max.description)
531-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(UInt8.min)).description, UInt8.min.description)
532-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(UInt8.max)).description, UInt8.max.description)
533-
534-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(Int16.min)).description, Int16.min.description)
535-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(Int16.max)).description, Int16.max.description)
536-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(UInt16.min)).description, UInt16.min.description)
537-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(UInt16.max)).description, UInt16.max.description)
538-
539-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(Int32.min)).description, Int32.min.description)
540-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(Int32.max)).description, Int32.max.description)
541-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(UInt32.min)).description, UInt32.min.description)
542-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(UInt32.max)).description, UInt32.max.description)
543-
544-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(Int64.min)).description, Int64.min.description)
545-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(Int64.max)).description, Int64.max.description)
546-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(UInt64.min)).description, UInt64.min.description)
547-
XCTAssertEqual(NSDecimalNumber(decimal: Decimal(UInt64.max)).description, UInt64.max.description)
548-
549-
XCTAssertEqual(try NSDecimalNumber(decimal: Decimal(string: "12.34").unwrapped()).description, "12.34")
550-
XCTAssertEqual(try NSDecimalNumber(decimal: Decimal(string: "0.0001").unwrapped()).description, "0.0001")
551-
XCTAssertEqual(try NSDecimalNumber(decimal: Decimal(string: "-1.0002").unwrapped()).description, "-1.0002")
552-
XCTAssertEqual(try NSDecimalNumber(decimal: Decimal(string: "0.0").unwrapped()).description, "0")
553528
}
554529

555530
func test_PositivePowers() {

0 commit comments

Comments
 (0)