From a8055a55fbf24f90c40520c07a3b58b43fa5e7d7 Mon Sep 17 00:00:00 2001 From: Tina L <49205802+itingliu@users.noreply.github.com> Date: Mon, 8 Sep 2025 09:54:34 -0700 Subject: [PATCH] Merge release/6.2.1 to release/6.2 (#1501) * Update 6.2.1 package dependency branches (#1496) * Locale.Region subregion API is misspelled (#1495) With @abi we can make an ABI compatible change so existing clients can continue to work on user's 6.2 devices even after they adopt the correct name on 6.2.1 and above. But only use @abi for FOUNDATION_FRAMEWORK since ABI compatibility isn't a concern in other scenarios. --------- Co-authored-by: Jeremy Schonfeld --- .../Locale/Locale+Components_ICU.swift | 6 +++++- .../LocaleRegionTests.swift | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Sources/FoundationInternationalization/Locale/Locale+Components_ICU.swift b/Sources/FoundationInternationalization/Locale/Locale+Components_ICU.swift index b257b65a8..43404cde7 100644 --- a/Sources/FoundationInternationalization/Locale/Locale+Components_ICU.swift +++ b/Sources/FoundationInternationalization/Locale/Locale+Components_ICU.swift @@ -417,7 +417,11 @@ extension Locale.Region { /// An array of the sub-regions, matching the specified category of the region. @available(FoundationPreview 6.2, *) - public func subRegions(ofCategoy category: Category) -> [Locale.Region] { +#if FOUNDATION_FRAMEWORK + // Renamed in 6.2.1 + @abi(func subRegions(ofCategoy category: Category) -> [Locale.Region]) +#endif + public func subRegions(ofCategory category: Category) -> [Locale.Region] { var status = U_ZERO_ERROR let icuRegion = uregion_getRegionFromCode(identifier, &status) guard let icuRegion, status.isSuccess else { diff --git a/Tests/FoundationInternationalizationTests/LocaleRegionTests.swift b/Tests/FoundationInternationalizationTests/LocaleRegionTests.swift index db475c916..288708d98 100644 --- a/Tests/FoundationInternationalizationTests/LocaleRegionTests.swift +++ b/Tests/FoundationInternationalizationTests/LocaleRegionTests.swift @@ -43,14 +43,14 @@ struct LocaleRegionTests { } @Test func subRegionOfCategory() async throws { - #expect(Locale.Region.unknown.subRegions(ofCategoy: .world) == []) - #expect(Locale.Region.unknown.subRegions(ofCategoy: .territory) == []) + #expect(Locale.Region.unknown.subRegions(ofCategory: .world) == []) + #expect(Locale.Region.unknown.subRegions(ofCategory: .territory) == []) - #expect(Set(Locale.Region.world.subRegions(ofCategoy: .continent)) == Set(Locale.Region.isoRegions(ofCategory: .continent))) + #expect(Set(Locale.Region.world.subRegions(ofCategory: .continent)) == Set(Locale.Region.isoRegions(ofCategory: .continent))) - #expect(Locale.Region.argentina.subRegions(ofCategoy: .continent) == []) - #expect(Locale.Region.argentina.subRegions(ofCategoy: .territory) == Locale.Region.argentina.subRegions) + #expect(Locale.Region.argentina.subRegions(ofCategory: .continent) == []) + #expect(Locale.Region.argentina.subRegions(ofCategory: .territory) == Locale.Region.argentina.subRegions) - #expect(Locale.Region("not a region").subRegions(ofCategoy: .territory) == []) + #expect(Locale.Region("not a region").subRegions(ofCategory: .territory) == []) } }