Skip to content

Commit 888ff1a

Browse files
committed
Revert "New value types for Calendar, TimeZone, and Locale"
This reverts commit 46a9f57. This broke Swift CI, OSS incremental RA: ./swift/stdlib/public/SDK/Foundation/TimeZone.swift:228:45: error: 'NSTimeZone' is not implicitly convertible to 'TimeZone'; did you mean to use 'as' to explicitly convert? return lhs._wrapped.isEqual(to: rhs._wrapped)
1 parent 46a9f57 commit 888ff1a

File tree

20 files changed

+52
-2497
lines changed

20 files changed

+52
-2497
lines changed

apinotes/Foundation.apinotes

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,7 @@ Classes:
647647
- Selector: 'stringFromByteCount:'
648648
SwiftName: stringFromByteCount(_:)
649649
MethodKind: Instance
650-
- Name: NSLocale
651-
SwiftName: NSLocale
652-
SwiftBridge: Locale
653-
- Name: NSTimeZone
654-
SwiftName: NSTimeZone
655-
SwiftBridge: TimeZone
656650
- Name: NSCalendar
657-
SwiftName: NSCalendar
658-
SwiftBridge: Calendar
659651
Methods:
660652
- Selector: 'dateWithEra:year:month:day:hour:minute:second:nanosecond:'
661653
SwiftName: date(era:year:month:day:hour:minute:second:nanosecond:)
@@ -1122,9 +1114,9 @@ Tags:
11221114
- Name: NSByteCountFormatterCountStyle
11231115
SwiftName: ByteCountFormatter.CountStyle
11241116
- Name: NSCalendarUnit
1125-
SwiftName: NSCalendar.Unit
1117+
SwiftName: Calendar.Unit
11261118
- Name: NSCalendarOptions
1127-
SwiftName: NSCalendar.Options
1119+
SwiftName: Calendar.Options
11281120
- Name: NSDecodingFailurePolicy
11291121
SwiftName: NSCoder.DecodingFailurePolicy
11301122
- Name: NSComparisonPredicateOptions
@@ -1237,7 +1229,7 @@ Tags:
12371229
Availability: nonswift
12381230
AvailabilityMsg: Use 'NSTextCheckingResult.CheckingType'
12391231
- Name: NSTimeZoneNameStyle
1240-
SwiftName: NSTimeZone.NameStyle
1232+
SwiftName: TimeZone.NameStyle
12411233
- Name: NSURLCacheStoragePolicy
12421234
SwiftName: URLCache.StoragePolicy
12431235
- Name: NSURLCredentialPersistence
@@ -1289,7 +1281,7 @@ Tags:
12891281
- Name: NSDateComponentsFormatterZeroFormattingBehavior
12901282
SwiftName: DateComponentsFormatter.ZeroFormattingBehavior
12911283
- Name: NSLocaleLanguageDirection
1292-
SwiftName: NSLocale.LanguageDirection
1284+
SwiftName: Locale.LanguageDirection
12931285
- Name: NSNetServiceOptions
12941286
SwiftName: NSNetService.Options
12951287
- Name: NSPointerFunctionsOptions
@@ -1356,13 +1348,13 @@ Typedefs:
13561348
- Name: NSBackgroundActivityCompletionHandler
13571349
SwiftName: NSBackgroundActivityScheduler.CompletionHandler
13581350
- Name: NSCalendarIdentifier
1359-
SwiftName: NSCalendar.Identifier
1351+
SwiftName: Calendar.Identifier
13601352
- Name: NSItemProviderCompletionHandler
13611353
SwiftName: NSItemProvider.CompletionHandler
13621354
- Name: NSItemProviderLoadHandler
13631355
SwiftName: NSItemProvider.LoadHandler
13641356
- Name: NSLocaleKey
1365-
SwiftName: NSLocale.Key
1357+
SwiftName: Locale.Key
13661358
- Name: NSNotificationName
13671359
SwiftName: NSNotification.Name
13681360
- Name: NSProgressFileOperationKind
@@ -1431,7 +1423,7 @@ Globals:
14311423
- Name: NSItemProviderErrorDomain
14321424
SwiftName: NSItemProvider.errorDomain
14331425
- Name: NSCurrentLocaleDidChangeNotification
1434-
SwiftName: NSLocale.currentLocaleDidChangeNotification
1426+
SwiftName: Locale.currentLocaleDidChangeNotification
14351427
- Name: NSNetServicesErrorDomain
14361428
SwiftName: NSNetService.errorDomain
14371429
- Name: NSNetServicesErrorCode

stdlib/private/StdlibUnittestFoundationExtras/StdlibUnittestFoundationExtras.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@
1313
import ObjectiveC
1414
import Foundation
1515

16-
internal var _temporaryLocaleCurrentLocale: NSLocale? = nil
16+
internal var _temporaryLocaleCurrentLocale: Locale? = nil
1717

18-
extension NSLocale {
18+
extension Locale {
1919
@objc
20-
public class func _swiftUnittest_currentLocale() -> NSLocale {
20+
public class func _swiftUnittest_currentLocale() -> Locale {
2121
return _temporaryLocaleCurrentLocale!
2222
}
2323
}
2424

2525
public func withOverriddenLocaleCurrentLocale<Result>(
26-
_ temporaryLocale: NSLocale,
26+
_ temporaryLocale: Locale,
2727
_ body: @noescape () -> Result
2828
) -> Result {
2929
let oldMethod = class_getClassMethod(
30-
NSLocale.self, #selector(getter: NSLocale.current))
30+
Locale.self, #selector(getter: Locale.current))
3131
precondition(oldMethod != nil, "could not find +[Locale currentLocale]")
3232

3333
let newMethod = class_getClassMethod(
34-
NSLocale.self, #selector(NSLocale._swiftUnittest_currentLocale))
34+
Locale.self, #selector(Locale._swiftUnittest_currentLocale))
3535
precondition(newMethod != nil, "could not find +[Locale _swiftUnittest_currentLocale]")
3636

3737
precondition(_temporaryLocaleCurrentLocale == nil,
@@ -51,11 +51,11 @@ public func withOverriddenLocaleCurrentLocale<Result>(
5151
_ body: @noescape () -> Result
5252
) -> Result {
5353
precondition(
54-
NSLocale.availableLocaleIdentifiers.contains(temporaryLocaleIdentifier),
54+
Locale.availableLocaleIdentifiers.contains(temporaryLocaleIdentifier),
5555
"requested locale \(temporaryLocaleIdentifier) is not available")
5656

5757
return withOverriddenLocaleCurrentLocale(
58-
NSLocale(localeIdentifier: temporaryLocaleIdentifier), body)
58+
Locale(localeIdentifier: temporaryLocaleIdentifier), body)
5959
}
6060

6161
/// Executes the `body` in an autorelease pool if the platform does not

stdlib/public/SDK/Foundation/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ add_swift_library(swiftFoundation ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_SD
77
ExtraStringAPIs.swift
88
ReferenceConvertible.swift
99
AffineTransform.swift
10-
Calendar.swift
11-
TimeZone.swift
12-
Locale.swift
1310
CharacterSet.swift
1411
Date.swift
1512
DateComponents.swift

0 commit comments

Comments
 (0)