Files
swift-mirror/stdlib/public/SDK/Foundation/DateComponents.swift
Devin Coughlin 524f273d99 [Foundation] Fix exclusivity warnings in DateComponents
DateComponents has a number of exclusivity warnings that all result from the same idiom
for applying mutation in computed properties:

    public var era: Int? {
        get { return _handle.map { _getter($0.era) } }
        set { _applyMutation { $0.era = _setter(newValue) } }
    }

Here _applyMutation() is a mutating method, so it requires exclusive access to 'self'
for the duration of the call. However, calling the _setter() method in the block
requires access to read 'self', which conflicts with the already in-progress modifying
access begun by _applyMutation().

A fix is to change _setter() to be a static function, so it doesn't require access to
'self'.
2018-03-25 19:47:50 -07:00

20 KiB