Skip to content

Update for SE-0193 #1527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2018
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
2 changes: 1 addition & 1 deletion Foundation/Boxing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
///
/// Note: This assumes that the result of calling copy() is mutable. The documentation says that classes which do not have a mutable/immutable distinction should just adopt NSCopying instead of NSMutableCopying.
internal final class _MutableHandle<MutableType : NSObject> where MutableType : NSCopying {
@_versioned internal var _pointer : MutableType
@usableFromInline internal var _pointer : MutableType

init(reference : MutableType) {
_pointer = reference.copy() as! MutableType
Expand Down
10 changes: 5 additions & 5 deletions Foundation/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,8 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
public typealias Index = Int
public typealias Indices = Range<Int>

@_versioned internal var _backing : _DataStorage
@_versioned internal var _sliceRange: Range<Index>
@usableFromInline internal var _backing : _DataStorage
@usableFromInline internal var _sliceRange: Range<Index>


// A standard or custom deallocator for `Data`.
Expand Down Expand Up @@ -1245,18 +1245,18 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
}
}

@_versioned
@usableFromInline
internal init(backing: _DataStorage, range: Range<Index>) {
_backing = backing
_sliceRange = range
}

@_versioned
@usableFromInline
internal func _validateIndex(_ index: Int, message: String? = nil) {
precondition(_sliceRange.contains(index), message ?? "Index \(index) is out of bounds of range \(_sliceRange)")
}

@_versioned
@usableFromInline
internal func _validateRange<R: RangeExpression>(_ range: R) where R.Bound == Int {
let lower = R.Bound(_sliceRange.lowerBound)
let upper = R.Bound(_sliceRange.upperBound)
Expand Down
4 changes: 2 additions & 2 deletions Foundation/IndexSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
public typealias ReferenceType = NSIndexSet
public typealias Element = Int

@_versioned
@usableFromInline
internal var _handle: _MutablePairHandle<NSIndexSet, NSMutableIndexSet>

/// Initialize an `IndexSet` with a range of integers.
Expand Down Expand Up @@ -846,7 +846,7 @@ internal enum _MutablePair<ImmutableType, MutableType> {
/// a.k.a. Box
internal final class _MutablePairHandle<ImmutableType : NSObject, MutableType : NSObject>
where ImmutableType : NSMutableCopying, MutableType : NSMutableCopying {
@_versioned
@usableFromInline
internal var _pointer: _MutablePair<ImmutableType, MutableType>

/// Initialize with an immutable reference instance.
Expand Down
6 changes: 2 additions & 4 deletions Foundation/NSStringAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,7 @@ extension StringProtocol where Index == String.Index {

// self can be a Substring so we need to subtract/add this offset when
// passing _ns to the Foundation APIs. Will be 0 if self is String.
@_inlineable
@_versioned
@inlinable
internal var _substringOffset: Int {
return self.startIndex.encodedOffset
}
Expand All @@ -447,8 +446,7 @@ extension StringProtocol where Index == String.Index {
return Index(encodedOffset: utf16Index + _substringOffset)
}

@_inlineable
@_versioned
@inlinable
internal func _toRelativeNSRange(_ r: Range<String.Index>) -> NSRange {
return NSRange(
location: r.lowerBound.encodedOffset - _substringOffset,
Expand Down
4 changes: 2 additions & 2 deletions Foundation/NSSwiftRuntime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ internal func _CFZeroUnsafeIvars<T>(_ arg: inout T) {
}
}

@_versioned
@usableFromInline
@_cdecl("__CFSwiftGetBaseClass")
internal func __CFSwiftGetBaseClass() -> UnsafeRawPointer {
return unsafeBitCast(__NSCFType.self, to:UnsafeRawPointer.self)
}

@_versioned
@usableFromInline
@_cdecl("__CFInitializeSwift")
internal func __CFInitializeSwift() {

Expand Down