From d13e8731b4de2642089bdf1907558aca33177668 Mon Sep 17 00:00:00 2001 From: Charles Hu Date: Mon, 22 Jul 2024 19:03:51 -0700 Subject: [PATCH] Temporary fix: rename function on number formatter to disambiguate As with the case in https://github.com/apple/swift-foundation-icu/pull/19, ICU is getting system ICU confused again. Disambiguate by adding underscore to the type name. --- icuSources/i18n/measfmt.cpp | 2 +- icuSources/i18n/number_fluent.cpp | 12 ++++++------ icuSources/i18n/smpdtfmt.cpp | 8 ++++---- .../include/_foundation_unicode/numberformatter.h | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/icuSources/i18n/measfmt.cpp b/icuSources/i18n/measfmt.cpp index 1f3b72a..632d920 100644 --- a/icuSources/i18n/measfmt.cpp +++ b/icuSources/i18n/measfmt.cpp @@ -1064,7 +1064,7 @@ UnicodeString &MeasureFormat::formatNumeric( } number::LocalizedNumberFormatter numberFormatter2; if (auto* lnf = numberFormatter->toNumberFormatter(status)) { - numberFormatter2 = lnf->integerWidth(number::IntegerWidth::zeroFillTo(2)); + numberFormatter2 = lnf->_integerWidth(number::IntegerWidth::zeroFillTo(2)); } else { return appendTo; } diff --git a/icuSources/i18n/number_fluent.cpp b/icuSources/i18n/number_fluent.cpp index 782a9be..ea049bb 100644 --- a/icuSources/i18n/number_fluent.cpp +++ b/icuSources/i18n/number_fluent.cpp @@ -177,14 +177,14 @@ Derived NumberFormatterSettings::grouping(UNumberGroupingStrategy strat } template -Derived NumberFormatterSettings::integerWidth(const IntegerWidth& style) const& { +Derived NumberFormatterSettings::_integerWidth(const IntegerWidth& style) const& { Derived copy(*this); copy.fMacros.integerWidth = style; return copy; } template -Derived NumberFormatterSettings::integerWidth(const IntegerWidth& style)&& { +Derived NumberFormatterSettings::_integerWidth(const IntegerWidth& style)&& { Derived move(std::move(*this)); move.fMacros.integerWidth = style; return move; @@ -362,14 +362,14 @@ Derived NumberFormatterSettings::threshold(int32_t threshold)&& { // rdar://107351099 SimpleDateFormat perf template -Derived NumberFormatterSettings::forDateFormat(bool forDateFormat) const& { +Derived NumberFormatterSettings::_forDateFormat(bool forDateFormat) const& { Derived copy(*this); copy.fMacros.forDateFormat = forDateFormat; return copy; } template -Derived NumberFormatterSettings::forDateFormat(bool forDateFormat)&& { +Derived NumberFormatterSettings::_forDateFormat(bool forDateFormat)&& { Derived move(std::move(*this)); move.fMacros.forDateFormat = forDateFormat; return move; @@ -408,12 +408,12 @@ Derived NumberFormatterSettings::macros(impl::MacroProps&& macros)&& { // Note: toSkeleton defined in number_skeletons.cpp template -LocalPointer NumberFormatterSettings::clone() const & { +LocalPointer NumberFormatterSettings::_clone() const & { return LocalPointer(new Derived(*this)); } template -LocalPointer NumberFormatterSettings::clone() && { +LocalPointer NumberFormatterSettings::_clone() && { return LocalPointer(new Derived(std::move(*this))); } diff --git a/icuSources/i18n/smpdtfmt.cpp b/icuSources/i18n/smpdtfmt.cpp index 467a2c5..a0458bb 100644 --- a/icuSources/i18n/smpdtfmt.cpp +++ b/icuSources/i18n/smpdtfmt.cpp @@ -1738,13 +1738,13 @@ createFastFormatter(const DecimalFormat* df, int32_t minInt, int32_t maxInt, UEr } #if APPLE_ICU_CHANGES // rdar://107351099 SimpleDateFormat perf+ - return lnfBase->integerWidth( + return lnfBase->_integerWidth( number::IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt) - ).forDateFormat(true).clone().orphan(); + )._forDateFormat(true)._clone().orphan(); #else - return lnfBase->integerWidth( + return lnfBase->_integerWidth( number::IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt) - ).clone().orphan(); + )._clone().orphan(); #endif // APPLE_ICU_CHANGES } diff --git a/icuSources/include/_foundation_unicode/numberformatter.h b/icuSources/include/_foundation_unicode/numberformatter.h index ec3a204..0fc31f2 100644 --- a/icuSources/include/_foundation_unicode/numberformatter.h +++ b/icuSources/include/_foundation_unicode/numberformatter.h @@ -1992,7 +1992,7 @@ class U_I18N_API NumberFormatterSettings { * @see IntegerWidth * @stable ICU 60 */ - Derived integerWidth(const IntegerWidth &style) const &; + Derived _integerWidth(const IntegerWidth &style) const &; /** * Overload of integerWidth() for use on an rvalue reference. @@ -2003,7 +2003,7 @@ class U_I18N_API NumberFormatterSettings { * @see #integerWidth * @stable ICU 62 */ - Derived integerWidth(const IntegerWidth &style) &&; + Derived _integerWidth(const IntegerWidth &style) &&; /** * Specifies the symbols (decimal separator, grouping separator, percent sign, numerals, etc.) to use when rendering @@ -2386,10 +2386,10 @@ class U_I18N_API NumberFormatterSettings { * * @internal: This API is ICU internal only. */ - Derived forDateFormat(bool forDateFormat) const &; + Derived _forDateFormat(bool forDateFormat) const &; /** @internal */ - Derived forDateFormat(bool forDateFormat) &&; + Derived _forDateFormat(bool forDateFormat) &&; #endif // APPLE_ICU_CHANGES @@ -2441,7 +2441,7 @@ class U_I18N_API NumberFormatterSettings { * nullptr on failure. * @stable ICU 64 */ - LocalPointer clone() const &; + LocalPointer _clone() const &; /** * Overload of clone for use on an rvalue reference. @@ -2450,7 +2450,7 @@ class U_I18N_API NumberFormatterSettings { * nullptr on failure. * @stable ICU 64 */ - LocalPointer clone() &&; + LocalPointer _clone() &&; /** * Sets the UErrorCode if an error occurred in the fluent chain.