Tina Liu e9d59b6065
Fix parsing foreign currency strings (#1074)
* Fix parsing foreign currency strings

Currently parsing a currency string would fail if the currency code does not match `FormatStyle`'s locale region. For example,

```swift
let style = Decimal.FormatStyle.Currency(code: "GBP", locale: .init(identifier: "en_US")).presentation(.isoCode)
```

This formats 3.14 into "GBP\u{0xa0}3.14", but parsing such string fails.

Fix this by always set the ICU formatter's currency code.

Resolves rdar://138179737

* Update the test to throw properly instead of force unwrap

* Remove another force try

* Remove the stored `numberFormatType` and `locale` inside `IntegerParseStrategy` and `FloatingPointParseStrategy`

These properties are redundant as the information is already available through the public variable `formatStyle`.

* Address feedback

* Fix a typo
2025-01-16 08:41:59 -08:00
..