Skip to content

Commit 6c42bcc

Browse files
authored
Merge pull request swiftlang#15507 from devincoughlin/foundation-datecomponents-exclusivity-warnings
2 parents e9d07d8 + 524f273 commit 6c42bcc

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

stdlib/public/SDK/Foundation/DateComponents.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
6767
private func _getter(_ x : Int) -> Int? { return x == NSDateComponentUndefined ? nil : x }
6868

6969
/// Translate from the proper Swift optional value into an NSDateComponentUndefined
70-
private func _setter(_ x : Int?) -> Int { if let xx = x { return xx } else { return NSDateComponentUndefined } }
70+
private static func _setter(_ x : Int?) -> Int { if let xx = x { return xx } else { return NSDateComponentUndefined } }
7171

7272
/// The `Calendar` used to interpret the other values in this structure.
7373
///
@@ -88,92 +88,92 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
8888
/// - note: This value is interpreted in the context of the calendar in which it is used.
8989
public var era: Int? {
9090
get { return _handle.map { _getter($0.era) } }
91-
set { _applyMutation { $0.era = _setter(newValue) } }
91+
set { _applyMutation { $0.era = DateComponents._setter(newValue) } }
9292
}
9393

9494
/// A year or count of years.
9595
/// - note: This value is interpreted in the context of the calendar in which it is used.
9696
public var year: Int? {
9797
get { return _handle.map { _getter($0.year) } }
98-
set { _applyMutation { $0.year = _setter(newValue) } }
98+
set { _applyMutation { $0.year = DateComponents._setter(newValue) } }
9999
}
100100

101101
/// A month or count of months.
102102
/// - note: This value is interpreted in the context of the calendar in which it is used.
103103
public var month: Int? {
104104
get { return _handle.map { _getter($0.month) } }
105-
set { _applyMutation { $0.month = _setter(newValue) } }
105+
set { _applyMutation { $0.month = DateComponents._setter(newValue) } }
106106
}
107107

108108
/// A day or count of days.
109109
/// - note: This value is interpreted in the context of the calendar in which it is used.
110110
public var day: Int? {
111111
get { return _handle.map { _getter($0.day) } }
112-
set { _applyMutation { $0.day = _setter(newValue) } }
112+
set { _applyMutation { $0.day = DateComponents._setter(newValue) } }
113113
}
114114

115115
/// An hour or count of hours.
116116
/// - note: This value is interpreted in the context of the calendar in which it is used.
117117
public var hour: Int? {
118118
get { return _handle.map { _getter($0.hour) } }
119-
set { _applyMutation { $0.hour = _setter(newValue) } }
119+
set { _applyMutation { $0.hour = DateComponents._setter(newValue) } }
120120
}
121121

122122
/// A minute or count of minutes.
123123
/// - note: This value is interpreted in the context of the calendar in which it is used.
124124
public var minute: Int? {
125125
get { return _handle.map { _getter($0.minute) } }
126-
set { _applyMutation { $0.minute = _setter(newValue) } }
126+
set { _applyMutation { $0.minute = DateComponents._setter(newValue) } }
127127
}
128128

129129
/// A second or count of seconds.
130130
/// - note: This value is interpreted in the context of the calendar in which it is used.
131131
public var second: Int? {
132132
get { return _handle.map { _getter($0.second) } }
133-
set { _applyMutation { $0.second = _setter(newValue) } }
133+
set { _applyMutation { $0.second = DateComponents._setter(newValue) } }
134134
}
135135

136136
/// A nanosecond or count of nanoseconds.
137137
/// - note: This value is interpreted in the context of the calendar in which it is used.
138138
public var nanosecond: Int? {
139139
get { return _handle.map { _getter($0.nanosecond) } }
140-
set { _applyMutation { $0.nanosecond = _setter(newValue) } }
140+
set { _applyMutation { $0.nanosecond = DateComponents._setter(newValue) } }
141141
}
142142

143143
/// A weekday or count of weekdays.
144144
/// - note: This value is interpreted in the context of the calendar in which it is used.
145145
public var weekday: Int? {
146146
get { return _handle.map { _getter($0.weekday) } }
147-
set { _applyMutation { $0.weekday = _setter(newValue) } }
147+
set { _applyMutation { $0.weekday = DateComponents._setter(newValue) } }
148148
}
149149

150150
/// A weekday ordinal or count of weekday ordinals.
151151
/// Weekday ordinal units represent the position of the weekday within the next larger calendar unit, such as the month. For example, 2 is the weekday ordinal unit for the second Friday of the month.///
152152
/// - note: This value is interpreted in the context of the calendar in which it is used.
153153
public var weekdayOrdinal: Int? {
154154
get { return _handle.map { _getter($0.weekdayOrdinal) } }
155-
set { _applyMutation { $0.weekdayOrdinal = _setter(newValue) } }
155+
set { _applyMutation { $0.weekdayOrdinal = DateComponents._setter(newValue) } }
156156
}
157157

158158
/// A quarter or count of quarters.
159159
/// - note: This value is interpreted in the context of the calendar in which it is used.
160160
public var quarter: Int? {
161161
get { return _handle.map { _getter($0.quarter) } }
162-
set { _applyMutation { $0.quarter = _setter(newValue) } }
162+
set { _applyMutation { $0.quarter = DateComponents._setter(newValue) } }
163163
}
164164

165165
/// A week of the month or a count of weeks of the month.
166166
/// - note: This value is interpreted in the context of the calendar in which it is used.
167167
public var weekOfMonth: Int? {
168168
get { return _handle.map { _getter($0.weekOfMonth) } }
169-
set { _applyMutation { $0.weekOfMonth = _setter(newValue) } }
169+
set { _applyMutation { $0.weekOfMonth = DateComponents._setter(newValue) } }
170170
}
171171

172172
/// A week of the year or count of the weeks of the year.
173173
/// - note: This value is interpreted in the context of the calendar in which it is used.
174174
public var weekOfYear: Int? {
175175
get { return _handle.map { _getter($0.weekOfYear) } }
176-
set { _applyMutation { $0.weekOfYear = _setter(newValue) } }
176+
set { _applyMutation { $0.weekOfYear = DateComponents._setter(newValue) } }
177177
}
178178

179179
/// The ISO 8601 week-numbering year of the receiver.
@@ -184,7 +184,7 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
184184
/// - note: This value is interpreted in the context of the calendar in which it is used.
185185
public var yearForWeekOfYear: Int? {
186186
get { return _handle.map { _getter($0.yearForWeekOfYear) } }
187-
set { _applyMutation { $0.yearForWeekOfYear = _setter(newValue) } }
187+
set { _applyMutation { $0.yearForWeekOfYear = DateComponents._setter(newValue) } }
188188
}
189189

190190
/// Set to true if these components represent a leap month.
@@ -219,7 +219,7 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
219219
@available(macOS 10.9, iOS 8.0, *)
220220
public mutating func setValue(_ value: Int?, for component: Calendar.Component) {
221221
_applyMutation {
222-
$0.setValue(_setter(value), forComponent: Calendar._toCalendarUnit([component]))
222+
$0.setValue(DateComponents._setter(value), forComponent: Calendar._toCalendarUnit([component]))
223223
}
224224
}
225225

0 commit comments

Comments
 (0)