Skip to content

Temporary fix: capture macros.unit to ensure we are using the right MeasureUnit is used with initIsBaseUnit #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions icuSources/i18n/number_formatimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,16 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe,
// TODO: Accept currency symbols from DecimalFormatSymbols?

// Pre-compute a few values for efficiency.
bool isCurrency = utils::unitIsCurrency(macros.unit);
bool isBaseUnit = utils::unitIsBaseUnit(macros.unit);
bool isPercent = utils::unitIsPercent(macros.unit);
bool isPermille = utils::unitIsPermille(macros.unit);

// SwiftFoundationICU temporary changes begin:
// Capture macros.unit to ensure we are loading
// the "correct" MeasureUnit object from the package.
auto unit = macros.unit;
bool isCurrency = utils::unitIsCurrency(unit);
bool isBaseUnit = utils::unitIsBaseUnit(unit);
bool isPercent = utils::unitIsPercent(unit);
bool isPermille = utils::unitIsPermille(unit);
// SwiftFoundationICU temporary changes end
bool isCompactNotation = macros.notation.fType == Notation::NTN_COMPACT;
bool isAccounting =
macros.sign == UNUM_SIGN_ACCOUNTING ||
Expand Down