diff --git a/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb b/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb index 8c8fa0d6e76..520c7d2505e 100644 --- a/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb +++ b/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb @@ -2660,7 +2660,7 @@ public func < ( /// /// This type can be used to check that generic functions don't rely on any /// other conformances. -public struct MinimalComparableIndexValue : Comparable, ForwardIndexType { +public struct MinimalComparableIndexValue : Comparable, ForwardIndex { public static var timesEqualEqualWasCalled = ResettableValue(0) public static var timesLessWasCalled = ResettableValue(0) diff --git a/stdlib/private/StdlibUnittestFoundationExtras/StdlibUnittestFoundationExtras.swift b/stdlib/private/StdlibUnittestFoundationExtras/StdlibUnittestFoundationExtras.swift index 9f69d3c836f..ae6f571e03e 100644 --- a/stdlib/private/StdlibUnittestFoundationExtras/StdlibUnittestFoundationExtras.swift +++ b/stdlib/private/StdlibUnittestFoundationExtras/StdlibUnittestFoundationExtras.swift @@ -27,12 +27,12 @@ public func withOverriddenNSLocaleCurrentLocale( @noescape _ body: () -> Result ) -> Result { let oldMethod = class_getClassMethod( - NSLocale.self, #selector(NSLocale.currentLocale)) - precondition(oldMethod != nil, "could not find +[NSLocale currentLocale]") + NSLocale.self, #selector(NSLocale.current)) + require(oldMethod != nil, "could not find +[NSLocale currentLocale]") let newMethod = class_getClassMethod( NSLocale.self, #selector(NSLocale._swiftUnittest_currentLocale)) - precondition(newMethod != nil, "could not find +[NSLocale _swiftUnittest_currentLocale]") + require(newMethod != nil, "could not find +[NSLocale _swiftUnittest_currentLocale]") require(_temporaryNSLocaleCurrentLocale == nil, "nested calls to withOverriddenNSLocaleCurrentLocale are not supported") diff --git a/stdlib/public/SDK/AppKit/AppKit.swift b/stdlib/public/SDK/AppKit/AppKit.swift index b68d6c4c688..9cf42c1001b 100644 --- a/stdlib/public/SDK/AppKit/AppKit.swift +++ b/stdlib/public/SDK/AppKit/AppKit.swift @@ -37,8 +37,8 @@ extension NSView : CustomPlaygroundQuickLookable { } else { _NSViewQuickLookState.views.insert(self) let result: PlaygroundQuickLook - if let b = bitmapImageRepForCachingDisplayInRect(bounds) { - cacheDisplayInRect(bounds, toBitmapImageRep: b) + if let b = bitmapImageRepForCachingDisplayIn(bounds) { + cacheDisplayIn(bounds, to: b) result = .View(b) } else { result = .View(NSImage()) diff --git a/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift b/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift index 1e8d36bc6a5..00c9f3682d8 100644 --- a/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift +++ b/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift @@ -35,11 +35,11 @@ public extension CGPoint { } extension CGPoint : CustomReflectable, CustomPlaygroundQuickLookable { - public func customMirror() -> Mirror { + public var customMirror: Mirror { return Mirror(self, children: ["x": x, "y": y], displayStyle: .Struct) } - public func customPlaygroundQuickLook() -> PlaygroundQuickLook { + public var customPlaygroundQuickLook: PlaygroundQuickLook { return .Point(Double(x), Double(y)) } } @@ -75,11 +75,11 @@ public extension CGSize { } extension CGSize : CustomReflectable, CustomPlaygroundQuickLookable { - public func customMirror() -> Mirror { + public var customMirror: Mirror { return Mirror(self, children: ["width": width, "height": height], displayStyle: .Struct) } - public func customPlaygroundQuickLook() -> PlaygroundQuickLook { + public var customPlaygroundQuickLook: PlaygroundQuickLook { return .Size(Double(width), Double(height)) } } @@ -294,11 +294,11 @@ public extension CGRect { } extension CGRect : CustomReflectable, CustomPlaygroundQuickLookable { - public func customMirror() -> Mirror { + public var customMirror: Mirror { return Mirror(self, children: ["origin": origin, "size": size], displayStyle: .Struct) } - public func customPlaygroundQuickLook() -> PlaygroundQuickLook { + public var customPlaygroundQuickLook: PlaygroundQuickLook { return .Rectangle(Double(origin.x), Double(origin.y), Double(size.width), Double(size.height)) } } diff --git a/stdlib/public/SDK/Foundation/Foundation.swift b/stdlib/public/SDK/Foundation/Foundation.swift index 4022538cc87..93aac87ec11 100644 --- a/stdlib/public/SDK/Foundation/Foundation.swift +++ b/stdlib/public/SDK/Foundation/Foundation.swift @@ -1399,19 +1399,19 @@ public typealias _FileReferenceLiteralType = NSURL //===----------------------------------------------------------------------===// extension NSURL : CustomPlaygroundQuickLookable { - public func customPlaygroundQuickLook() -> PlaygroundQuickLook { + public var customPlaygroundQuickLook: PlaygroundQuickLook { return .URL(absoluteString) } } extension NSRange : CustomReflectable { - public func customMirror() -> Mirror { + public var customMirror: Mirror { return Mirror(self, children: ["location": location, "length": length]) } } extension NSRange : CustomPlaygroundQuickLookable { - public func customPlaygroundQuickLook() -> PlaygroundQuickLook { + public var customPlaygroundQuickLook: PlaygroundQuickLook { return .Range(Int64(location), Int64(length)) } } @@ -1421,34 +1421,34 @@ extension NSDate : CustomPlaygroundQuickLookable { let df = NSDateFormatter() df.dateStyle = .MediumStyle df.timeStyle = .ShortStyle - return df.stringFromDate(self) + return df.stringFrom(self) } - public func customPlaygroundQuickLook() -> PlaygroundQuickLook { + public var customPlaygroundQuickLook: PlaygroundQuickLook { return .Text(summary) } } extension NSSet : CustomReflectable { - public func customMirror() -> Mirror { + public var customMirror: Mirror { return Mirror(reflecting: self as Set) } } extension NSString : CustomPlaygroundQuickLookable { - public func customPlaygroundQuickLook() -> PlaygroundQuickLook { + public var customPlaygroundQuickLook: PlaygroundQuickLook { return .Text(self as String) } } extension NSArray : CustomReflectable { - public func customMirror() -> Mirror { + public var customMirror: Mirror { return Mirror(reflecting: self as [AnyObject]) } } extension NSDictionary : CustomReflectable { - public func customMirror() -> Mirror { + public var customMirror: Mirror { return Mirror(reflecting: self as [NSObject : AnyObject]) } } diff --git a/stdlib/public/SDK/SpriteKit/SpriteKitQuickLooks.swift.gyb b/stdlib/public/SDK/SpriteKit/SpriteKitQuickLooks.swift.gyb index 3632c7d2e06..b6eff18192f 100644 --- a/stdlib/public/SDK/SpriteKit/SpriteKitQuickLooks.swift.gyb +++ b/stdlib/public/SDK/SpriteKit/SpriteKitQuickLooks.swift.gyb @@ -15,7 +15,7 @@ % for Self in ['SKShapeNode', 'SKSpriteNode', 'SKTextureAtlas', 'SKTexture']: extension ${Self} : CustomPlaygroundQuickLookable { - public func customPlaygroundQuickLook() -> PlaygroundQuickLook { + public var customPlaygroundQuickLook: PlaygroundQuickLook { // this code comes straight from the quicklooks let data = (self as AnyObject)._copyImageData?() diff --git a/stdlib/public/core/Arrays.swift.gyb b/stdlib/public/core/Arrays.swift.gyb index 6c475a6d7a1..6a886c227c0 100644 --- a/stdlib/public/core/Arrays.swift.gyb +++ b/stdlib/public/core/Arrays.swift.gyb @@ -773,7 +773,6 @@ extension ${Self} : _ArrayProtocol { extension ${Self} : CustomReflectable { /// Returns a mirror that reflects `self`. - @warn_unused_result public var customMirror: Mirror { return Mirror(self, unlabeledChildren: self, displayStyle: .Collection) } diff --git a/stdlib/public/core/Collection.swift b/stdlib/public/core/Collection.swift index e5485209c33..1e89eda165d 100644 --- a/stdlib/public/core/Collection.swift +++ b/stdlib/public/core/Collection.swift @@ -221,8 +221,8 @@ extension Collection where SubSequence == Self { } } -extension CollectionType where - SubSequence == Self, Index : BidirectionalIndexType { +extension Collection where + SubSequence == Self, Index : BidirectionalIndex { /// If `!self.isEmpty`, remove the last element and return it, otherwise /// return `nil`. /// diff --git a/stdlib/public/core/HashedCollections.swift.gyb b/stdlib/public/core/HashedCollections.swift.gyb index 3458bcdca80..c79ef6b94a0 100644 --- a/stdlib/public/core/HashedCollections.swift.gyb +++ b/stdlib/public/core/HashedCollections.swift.gyb @@ -3997,17 +3997,15 @@ public struct ${Self}Iterator<${TypeParametersDecl}> : IteratorProtocol { } } -extension ${Self}Generator : CustomReflectable { +extension ${Self}Iterator : CustomReflectable { /// Returns a mirror that reflects `self`. - @warn_unused_result - public func customMirror() -> Mirror { + public var customMirror: Mirror { return Mirror(self, children: []) } } extension ${Self} : CustomReflectable { /// Returns a mirror that reflects `self`. - @warn_unused_result public var customMirror: Mirror { %if Self == 'Set': let style = Mirror.DisplayStyle.Set diff --git a/stdlib/public/core/OutputStream.swift b/stdlib/public/core/OutputStream.swift index 3a340e724b8..662fc6d309a 100644 --- a/stdlib/public/core/OutputStream.swift +++ b/stdlib/public/core/OutputStream.swift @@ -136,7 +136,7 @@ internal func _adHocPrint_unlocked( } target.write(")") case .Enum: - if let caseName = String.fromCString(_getEnumCaseName(value)) { + if let caseName = String(validatingUTF8: _getEnumCaseName(value)) { // Write the qualified type name in debugPrint. if isDebugPrint { printTypeName(mirror.subjectType) @@ -252,7 +252,7 @@ public func _debugPrint_unlocked( _adHocPrint_unlocked(value, mirror, &target, isDebugPrint: true) } -internal func _dumpPrint_unlocked( +internal func _dumpPrint_unlocked( value: T, _ mirror: Mirror, inout _ target: TargetStream ) { if let displayStyle = mirror.displayStyle { @@ -303,7 +303,7 @@ internal func _dumpPrint_unlocked( return case .Enum: target.write(_typeName(mirror.subjectType, qualified: true)) - if let caseName = String.fromCString(_getEnumCaseName(value)) { + if let caseName = String(validatingUTF8: _getEnumCaseName(value)) { target.write(".") target.write(caseName) } diff --git a/stdlib/public/core/Range.swift b/stdlib/public/core/Range.swift index e80cc434915..76e99ba00d4 100644 --- a/stdlib/public/core/Range.swift +++ b/stdlib/public/core/Range.swift @@ -142,7 +142,7 @@ public struct Range< } extension Range : CustomReflectable { - public func customMirror() -> Mirror { + public var customMirror: Mirror { return Mirror(self, children: ["startIndex": startIndex, "endIndex": endIndex]) } } diff --git a/stdlib/public/core/Reflection.swift b/stdlib/public/core/Reflection.swift index 5f1bae77ae2..56aae18bab6 100644 --- a/stdlib/public/core/Reflection.swift +++ b/stdlib/public/core/Reflection.swift @@ -227,7 +227,7 @@ internal func _dumpObject_unlocked( guard maxDepth > 0 else { return } - if let superclassMirror = mirror.superclassMirror() { + if let superclassMirror = mirror.superclassMirror { _dumpSuperclass_unlocked(superclassMirror, indent + 2, maxDepth - 1, &maxItemCounter, &visitedItems, &targetStream) } @@ -279,7 +279,7 @@ internal func _dumpSuperclass_unlocked( guard maxDepth > 0 else { return } - if let superclassMirror = mirror.superclassMirror() { + if let superclassMirror = mirror.superclassMirror { _dumpSuperclass_unlocked(superclassMirror, indent + 2, maxDepth - 1, &maxItemCounter, &visitedItems, &targetStream) } diff --git a/stdlib/public/core/StaticString.swift b/stdlib/public/core/StaticString.swift index 3ac0481c42a..3af91be3d62 100644 --- a/stdlib/public/core/StaticString.swift +++ b/stdlib/public/core/StaticString.swift @@ -232,7 +232,7 @@ public struct StaticString extension StaticString { public var customMirror: Mirror { - return Mirror(reflecting: stringValue) + return Mirror(reflecting: String(self)) } } diff --git a/stdlib/public/core/UnsafePointer.swift.gyb b/stdlib/public/core/UnsafePointer.swift.gyb index 69fbb92e949..1deff7f6590 100644 --- a/stdlib/public/core/UnsafePointer.swift.gyb +++ b/stdlib/public/core/UnsafePointer.swift.gyb @@ -482,7 +482,7 @@ extension ${Self} : CustomPlaygroundQuickLookable { return ptrValue == 0 ? "\(selfType)(nil)" : "\(selfType)(0x\(_uint64ToString(ptrValue, radix:16, uppercase:true)))" } - public func customPlaygroundQuickLook() -> PlaygroundQuickLook { + public var customPlaygroundQuickLook: PlaygroundQuickLook { return .Text(summary) } }