Skip to content
Merged
Show file tree
Hide file tree
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
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 <jschonfeld@apple.com>
  • Loading branch information
itingliu and jmschonfeld authored Sep 8, 2025
commit a8055a55fbf24f90c40520c07a3b58b43fa5e7d7
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) == [])
}
}