diff --git a/stdlib/public/core/ArrayBuffer.swift b/stdlib/public/core/ArrayBuffer.swift index c95673d701e..dd78c475596 100644 --- a/stdlib/public/core/ArrayBuffer.swift +++ b/stdlib/public/core/ArrayBuffer.swift @@ -415,14 +415,14 @@ extension _ArrayBuffer { /// underlying contiguous storage. If no such storage exists, it is /// created on-demand. public func withUnsafeBufferPointer( - @noescape body: (UnsafeBufferPointer) throws -> R - ) rethrows -> R { + @noescape body: (UnsafeBufferPointer) -> R + ) -> R { if _fastPath(_isNative) { - defer { _fixLifetime(self) } - return try body(UnsafeBufferPointer(start: self.baseAddress, - count: count)) + let ret = body(UnsafeBufferPointer(start: self.baseAddress, count: count)) + _fixLifetime(self) + return ret } - return try ContiguousArray(self).withUnsafeBufferPointer(body) + return ContiguousArray(self).withUnsafeBufferPointer(body) } /// Call `body(p)`, where `p` is an `UnsafeMutableBufferPointer` @@ -430,15 +430,16 @@ extension _ArrayBuffer { /// /// - Requires: Such contiguous storage exists or the buffer is empty. public mutating func withUnsafeMutableBufferPointer( - @noescape body: (UnsafeMutableBufferPointer) throws -> R - ) rethrows -> R { + @noescape body: (UnsafeMutableBufferPointer) -> R + ) -> R { _sanityCheck( baseAddress != nil || count == 0, "Array is bridging an opaque NSArray; can't get a pointer to the elements" ) - defer { _fixLifetime(self) } - return try body( + let ret = body( UnsafeMutableBufferPointer(start: baseAddress, count: count)) + _fixLifetime(self) + return ret } /// An object that keeps the elements stored in this buffer alive. diff --git a/stdlib/public/core/ArrayBufferType.swift b/stdlib/public/core/ArrayBufferType.swift index 502a4f658b2..d24d05eeff9 100644 --- a/stdlib/public/core/ArrayBufferType.swift +++ b/stdlib/public/core/ArrayBufferType.swift @@ -76,16 +76,16 @@ public protocol _ArrayBufferType : MutableCollectionType { /// underlying contiguous storage. If no such storage exists, it is /// created on-demand. func withUnsafeBufferPointer( - @noescape body: (UnsafeBufferPointer) throws -> R - ) rethrows -> R + @noescape body: (UnsafeBufferPointer) -> R + ) -> R /// Call `body(p)`, where `p` is an `UnsafeMutableBufferPointer` /// over the underlying contiguous storage. /// /// - Requires: Such contiguous storage exists or the buffer is empty. mutating func withUnsafeMutableBufferPointer( - @noescape body: (UnsafeMutableBufferPointer) throws -> R - ) rethrows -> R + @noescape body: (UnsafeMutableBufferPointer) -> R + ) -> R /// The number of elements the buffer stores. var count: Int {get set} diff --git a/stdlib/public/core/Arrays.swift.gyb b/stdlib/public/core/Arrays.swift.gyb index 833ebed1f51..a220755bcc1 100644 --- a/stdlib/public/core/Arrays.swift.gyb +++ b/stdlib/public/core/Arrays.swift.gyb @@ -638,17 +638,17 @@ extension ${Self} : _ArrayType { //===--- algorithms -----------------------------------------------------===// public mutating func _withUnsafeMutableBufferPointerIfSupported( - @noescape body: (inout UnsafeMutableBufferPointer) throws -> R - ) rethrows -> R? { + @noescape body: (inout UnsafeMutableBufferPointer) -> R + ) -> R? { // FIXME: Can't write simple code because of: // Assertion failure while emitting SIL for // _withUnsafeMutableBufferPointerIfSupported //return withUnsafeMutableBufferPointer { body($0) } - return try withUnsafeMutableBufferPointer { + return withUnsafeMutableBufferPointer { (bufferPointer) -> R in - let r = try body(&bufferPointer) + let r = body(&bufferPointer) return r } } @@ -739,9 +739,9 @@ extension ${Self} { /// same algorithm on `body`'s argument lets you trade safety for /// speed. public func withUnsafeBufferPointer( - @noescape body: (UnsafeBufferPointer) throws -> R - ) rethrows -> R { - return try _buffer.withUnsafeBufferPointer(body) + @noescape body: (UnsafeBufferPointer) -> R + ) -> R { + return _buffer.withUnsafeBufferPointer(body) } /// Call `body(p)`, where `p` is a pointer to the `${Self}`'s @@ -757,8 +757,8 @@ extension ${Self} { /// `body`: it may not appear to have its correct value. Instead, /// use only the `UnsafeMutableBufferPointer` argument to `body`. public mutating func withUnsafeMutableBufferPointer( - @noescape body: (inout UnsafeMutableBufferPointer) throws -> R - ) rethrows -> R { + @noescape body: (inout UnsafeMutableBufferPointer) -> R + ) -> R { // Ensure unique storage _arrayReserve(&_buffer, 0) @@ -773,18 +773,17 @@ extension ${Self} { var inoutBufferPointer = UnsafeMutableBufferPointer( start: pointer, count: count) + // Invoke the body + let ret = body(&inoutBufferPointer) + + _precondition( + inoutBufferPointer.baseAddress == pointer && + inoutBufferPointer.count == count, + "${Self} withUnsafeMutableBufferPointer: replacing the buffer is not allowed") + // Put the working array back before returning. - defer { - _precondition( - inoutBufferPointer.baseAddress == pointer && - inoutBufferPointer.count == count, - "${Self} withUnsafeMutableBufferPointer: replacing the buffer is not allowed") - - swap(&work, &self) - } - - // Invoke the body. - return try body(&inoutBufferPointer) + swap(&work, &self) + return ret } } %end diff --git a/stdlib/public/core/Collection.swift b/stdlib/public/core/Collection.swift index c35129f91f4..42dcd9aa97e 100644 --- a/stdlib/public/core/Collection.swift +++ b/stdlib/public/core/Collection.swift @@ -564,18 +564,14 @@ public protocol MutableCollectionType : CollectionType { /// same algorithm on `body`\ 's argument lets you trade safety for /// speed. mutating func _withUnsafeMutableBufferPointerIfSupported( - @noescape body: ( - inout UnsafeMutableBufferPointer - ) throws -> R - ) rethrows -> R? + @noescape body: (inout UnsafeMutableBufferPointer) -> R + ) -> R? } extension MutableCollectionType { public mutating func _withUnsafeMutableBufferPointerIfSupported( - @noescape body: ( - inout UnsafeMutableBufferPointer - ) throws -> R - ) rethrows -> R? { + @noescape body: (inout UnsafeMutableBufferPointer) -> R + ) -> R? { return nil } } diff --git a/stdlib/public/core/CollectionAlgorithms.swift.gyb b/stdlib/public/core/CollectionAlgorithms.swift.gyb index 13995007c89..ec1f12551cf 100644 --- a/stdlib/public/core/CollectionAlgorithms.swift.gyb +++ b/stdlib/public/core/CollectionAlgorithms.swift.gyb @@ -57,10 +57,10 @@ extension CollectionType { /// /// - Complexity: O(`self.count`). public func indexOf( - @noescape predicate: (${GElement}) throws -> Bool - ) rethrows -> Index? { + @noescape predicate: (${GElement}) -> Bool + ) -> Index? { for i in self.indices { - if try predicate(self[i]) { + if predicate(self[i]) { return i } } diff --git a/stdlib/public/core/ContiguousArrayBuffer.swift b/stdlib/public/core/ContiguousArrayBuffer.swift index f630ac3f3fb..14d5f0bd031 100644 --- a/stdlib/public/core/ContiguousArrayBuffer.swift +++ b/stdlib/public/core/ContiguousArrayBuffer.swift @@ -29,9 +29,9 @@ internal final class _EmptyArrayStorage #if _runtime(_ObjC) override func _withVerbatimBridgedUnsafeBuffer( - @noescape body: (UnsafeBufferPointer) throws -> R - ) rethrows -> R? { - return try body(UnsafeBufferPointer(start: nil, count: 0)) + @noescape body: (UnsafeBufferPointer) -> R + ) -> R? { + return body(UnsafeBufferPointer(start: nil, count: 0)) } override func _getNonVerbatimBridgedCount(dummy: Void) -> Int { @@ -74,11 +74,11 @@ class _ContiguousArrayStorage1 : _ContiguousArrayStorageBase { /// `UnsafeBufferPointer` to the elements and return the result. /// Otherwise, return `nil`. final override func _withVerbatimBridgedUnsafeBuffer( - @noescape body: (UnsafeBufferPointer) throws -> R - ) rethrows -> R? { + @noescape body: (UnsafeBufferPointer) -> R + ) -> R? { var result: R? = nil - try self._withVerbatimBridgedUnsafeBufferImpl { - result = try body($0) + self._withVerbatimBridgedUnsafeBufferImpl { + result = body($0) } return result } @@ -86,8 +86,8 @@ class _ContiguousArrayStorage1 : _ContiguousArrayStorageBase { /// If `Element` is bridged verbatim, invoke `body` on an /// `UnsafeBufferPointer` to the elements. internal func _withVerbatimBridgedUnsafeBufferImpl( - @noescape body: (UnsafeBufferPointer) throws -> Void - ) rethrows { + @noescape body: (UnsafeBufferPointer) -> Void + ) { _sanityCheckFailure( "Must override _withVerbatimBridgedUnsafeBufferImpl in derived classes") } @@ -107,13 +107,13 @@ final class _ContiguousArrayStorage : _ContiguousArrayStorage1 { /// If `Element` is bridged verbatim, invoke `body` on an /// `UnsafeBufferPointer` to the elements. internal final override func _withVerbatimBridgedUnsafeBufferImpl( - @noescape body: (UnsafeBufferPointer) throws -> Void - ) rethrows { + @noescape body: (UnsafeBufferPointer) -> Void + ) { if _isBridgedVerbatimToObjectiveC(Element.self) { let count = __manager.value.count let elements = UnsafePointer(__manager._elementPointer) - defer { _fixLifetime(__manager) } - try body(UnsafeBufferPointer(start: elements, count: count)) + body(UnsafeBufferPointer(start: elements, count: count)) + _fixLifetime(__manager) } } @@ -233,20 +233,22 @@ public struct _ContiguousArrayBuffer : _ArrayBufferType { /// Call `body(p)`, where `p` is an `UnsafeBufferPointer` over the /// underlying contiguous storage. public func withUnsafeBufferPointer( - @noescape body: UnsafeBufferPointer throws -> R - ) rethrows -> R { - defer { _fixLifetime(self) } - return try body(UnsafeBufferPointer(start: self.baseAddress, count: count)) + @noescape body: UnsafeBufferPointer -> R + ) -> R { + let ret = body(UnsafeBufferPointer(start: self.baseAddress, count: count)) + _fixLifetime(self) + return ret } /// Call `body(p)`, where `p` is an `UnsafeMutableBufferPointer` /// over the underlying contiguous storage. public mutating func withUnsafeMutableBufferPointer( - @noescape body: UnsafeMutableBufferPointer throws -> R - ) rethrows -> R { - defer { _fixLifetime(self) } - return try body( + @noescape body: UnsafeMutableBufferPointer -> R + ) -> R { + let ret = body( UnsafeMutableBufferPointer(start: baseAddress, count: count)) + _fixLifetime(self) + return ret } internal func _getBaseAddress() -> UnsafeMutablePointer { diff --git a/stdlib/public/core/ImplicitlyUnwrappedOptional.swift b/stdlib/public/core/ImplicitlyUnwrappedOptional.swift index 73936194b5a..c890a4d7aed 100644 --- a/stdlib/public/core/ImplicitlyUnwrappedOptional.swift +++ b/stdlib/public/core/ImplicitlyUnwrappedOptional.swift @@ -45,22 +45,21 @@ public enum ImplicitlyUnwrappedOptional } /// If `self == nil`, returns `nil`. Otherwise, returns `f(self!)`. - public func map(@noescape f: (T) throws -> U) - rethrows -> ImplicitlyUnwrappedOptional { + public func map(@noescape f: (T) -> U) -> ImplicitlyUnwrappedOptional { switch self { case .Some(let y): - return .Some(try f(y)) + return .Some(f(y)) case .None: return .None } } /// Returns `nil` if `self` is nil, `f(self!)` otherwise. - public func flatMap(@noescape f: (T) throws -> ImplicitlyUnwrappedOptional) - rethrows -> ImplicitlyUnwrappedOptional { + public func flatMap(@noescape f: (T) -> ImplicitlyUnwrappedOptional) + -> ImplicitlyUnwrappedOptional { switch self { case .Some(let y): - return try f(y) + return f(y) case .None: return .None } diff --git a/stdlib/public/core/LifetimeManager.swift b/stdlib/public/core/LifetimeManager.swift index d5b647d5dd2..0cad9480526 100644 --- a/stdlib/public/core/LifetimeManager.swift +++ b/stdlib/public/core/LifetimeManager.swift @@ -13,19 +13,21 @@ /// Evaluate `f()` and return its result, ensuring that `x` is not /// destroyed before f returns. public func withExtendedLifetime( - x: T, @noescape _ f: () throws -> Result -) rethrows -> Result { - defer { _fixLifetime(x) } - return try f() + x: T, @noescape _ f: () -> Result +) -> Result { + let result = f() + _fixLifetime(x) + return result } /// Evaluate `f(x)` and return its result, ensuring that `x` is not /// destroyed before f returns. public func withExtendedLifetime( - x: T, @noescape _ f: T throws -> Result -) rethrows -> Result { - defer { _fixLifetime(x) } - return try f(x) + x: T, @noescape _ f: T -> Result +) -> Result { + let result = f(x) + _fixLifetime(x) + return result } extension String { @@ -34,10 +36,10 @@ extension String { /// a nul-terminated array of char, ensuring that the array's /// lifetime extends through the execution of `f`. public func withCString( - @noescape f: UnsafePointer throws -> Result - ) rethrows -> Result { - return try self.nulTerminatedUTF8.withUnsafeBufferPointer { - try f(UnsafePointer($0.baseAddress)) + @noescape f: UnsafePointer -> Result + ) -> Result { + return self.nulTerminatedUTF8.withUnsafeBufferPointer { + f(UnsafePointer($0.baseAddress)) } } } @@ -54,20 +56,19 @@ public func _fixLifetime(x: T) { /// parameters (and default-constructible "out" parameters) by pointer. public func withUnsafeMutablePointer( inout arg: T, - @noescape _ body: UnsafeMutablePointer throws -> Result -) rethrows -> Result + @noescape _ body: UnsafeMutablePointer -> Result +) -> Result { - return try body(UnsafeMutablePointer(Builtin.addressof(&arg))) + return body(UnsafeMutablePointer(Builtin.addressof(&arg))) } /// Like `withUnsafeMutablePointer`, but passes pointers to `arg0` and `arg1`. public func withUnsafeMutablePointers( inout arg0: A0, inout _ arg1: A1, - @noescape _ body: ( - UnsafeMutablePointer, UnsafeMutablePointer) throws -> Result -) rethrows -> Result { - return try body( + @noescape _ body: (UnsafeMutablePointer, UnsafeMutablePointer) -> Result +) -> Result { + return body( UnsafeMutablePointer(Builtin.addressof(&arg0)), UnsafeMutablePointer(Builtin.addressof(&arg1))) } @@ -82,9 +83,9 @@ public func withUnsafeMutablePointers( UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer - ) throws -> Result -) rethrows -> Result { - return try body( + ) -> Result +) -> Result { + return body( UnsafeMutablePointer(Builtin.addressof(&arg0)), UnsafeMutablePointer(Builtin.addressof(&arg1)), UnsafeMutablePointer(Builtin.addressof(&arg2))) @@ -95,19 +96,19 @@ public func withUnsafeMutablePointers( /// parameters (and default-constructible "out" parameters) by pointer. public func withUnsafePointer( inout arg: T, - @noescape _ body: UnsafePointer throws -> Result -) rethrows -> Result + @noescape _ body: UnsafePointer -> Result +) -> Result { - return try body(UnsafePointer(Builtin.addressof(&arg))) + return body(UnsafePointer(Builtin.addressof(&arg))) } /// Like `withUnsafePointer`, but passes pointers to `arg0` and `arg1`. public func withUnsafePointers( inout arg0: A0, inout _ arg1: A1, - @noescape _ body: (UnsafePointer, UnsafePointer) throws -> Result -) rethrows -> Result { - return try body( + @noescape _ body: (UnsafePointer, UnsafePointer) -> Result +) -> Result { + return body( UnsafePointer(Builtin.addressof(&arg0)), UnsafePointer(Builtin.addressof(&arg1))) } @@ -122,9 +123,9 @@ public func withUnsafePointers( UnsafePointer, UnsafePointer, UnsafePointer - ) throws -> Result -) rethrows -> Result { - return try body( + ) -> Result +) -> Result { + return body( UnsafePointer(Builtin.addressof(&arg0)), UnsafePointer(Builtin.addressof(&arg1)), UnsafePointer(Builtin.addressof(&arg2))) diff --git a/stdlib/public/core/Optional.swift b/stdlib/public/core/Optional.swift index 4fd66486108..9b8e765299b 100644 --- a/stdlib/public/core/Optional.swift +++ b/stdlib/public/core/Optional.swift @@ -25,20 +25,20 @@ public enum Optional : _Reflectable, NilLiteralConvertible { public init(_ some: T) { self = .Some(some) } /// If `self == nil`, returns `nil`. Otherwise, returns `f(self!)`. - public func map(@noescape f: (T) throws -> U) rethrows -> U? { + public func map(@noescape f: (T)->U) -> U? { switch self { case .Some(let y): - return .Some(try f(y)) + return .Some(f(y)) case .None: return .None } } /// Returns `nil` if `self` is nil, `f(self!)` otherwise. - public func flatMap(@noescape f: (T) throws -> U?) rethrows -> U? { + public func flatMap(@noescape f: (T)->U?) -> U? { switch self { case .Some(let y): - return try f(y) + return f(y) case .None: return .None } diff --git a/stdlib/public/core/SliceBuffer.swift b/stdlib/public/core/SliceBuffer.swift index dc4f9339719..9b599da0d0b 100644 --- a/stdlib/public/core/SliceBuffer.swift +++ b/stdlib/public/core/SliceBuffer.swift @@ -306,20 +306,22 @@ struct _SliceBuffer : _ArrayBufferType { /// underlying contiguous storage. public func withUnsafeBufferPointer( - @noescape body: (UnsafeBufferPointer) throws -> R - ) rethrows -> R { - defer { _fixLifetime(self) } - return try body(UnsafeBufferPointer(start: self.baseAddress, count: count)) + @noescape body: (UnsafeBufferPointer) -> R + ) -> R { + let ret = body(UnsafeBufferPointer(start: self.baseAddress, count: count)) + _fixLifetime(self) + return ret } /// Call `body(p)`, where `p` is an `UnsafeMutableBufferPointer` /// over the underlying contiguous storage. public mutating func withUnsafeMutableBufferPointer( - @noescape body: (UnsafeMutableBufferPointer) throws -> R - ) rethrows -> R { - defer { _fixLifetime(self) } - return try body( + @noescape body: (UnsafeMutableBufferPointer) -> R + ) -> R { + let ret = body( UnsafeMutableBufferPointer(start: baseAddress, count: count)) + _fixLifetime(self) + return ret } } diff --git a/stdlib/public/core/SwiftNativeNSArray.swift b/stdlib/public/core/SwiftNativeNSArray.swift index c8c1ba7d000..bb7c415dc14 100644 --- a/stdlib/public/core/SwiftNativeNSArray.swift +++ b/stdlib/public/core/SwiftNativeNSArray.swift @@ -42,8 +42,8 @@ class _SwiftNativeNSArrayWithContiguousStorage // Operate on our contiguous storage internal func withUnsafeBufferOfObjects( - @noescape body: UnsafeBufferPointer throws -> R - ) rethrows -> R { + @noescape body: UnsafeBufferPointer -> R + ) -> R { _sanityCheckFailure( "Must override withUnsafeBufferOfObjects in derived classes") } @@ -163,8 +163,8 @@ extension _SwiftNativeNSArrayWithContiguousStorage: _NSArrayCoreType { } internal override func withUnsafeBufferOfObjects( - @noescape body: UnsafeBufferPointer throws -> R - ) rethrows -> R { + @noescape body: UnsafeBufferPointer -> R + ) -> R { repeat { var buffer: UnsafeBufferPointer @@ -197,8 +197,9 @@ extension _SwiftNativeNSArrayWithContiguousStorage: _NSArrayCoreType { continue // try again } - defer { _fixLifetime(self) } - return try body(buffer) + let result = body(buffer) + _fixLifetime(self) + return result } while true } @@ -229,9 +230,9 @@ internal class _ContiguousArrayStorageBase #if _runtime(_ObjC) internal override func withUnsafeBufferOfObjects( - @noescape body: UnsafeBufferPointer throws -> R - ) rethrows -> R { - if let result = try _withVerbatimBridgedUnsafeBuffer(body) { + @noescape body: UnsafeBufferPointer -> R + ) -> R { + if let result = _withVerbatimBridgedUnsafeBuffer(body) { return result } _sanityCheckFailure( @@ -242,8 +243,8 @@ internal class _ContiguousArrayStorageBase /// `UnsafeBufferPointer` to the elements and return the result. /// Otherwise, return `nil`. internal func _withVerbatimBridgedUnsafeBuffer( - @noescape body: UnsafeBufferPointer throws -> R - ) rethrows -> R? { + @noescape body: UnsafeBufferPointer -> R + ) -> R? { _sanityCheckFailure( "Concrete subclasses must implement _withVerbatimBridgedUnsafeBuffer") } diff --git a/test/Constraints/protocols.swift b/test/Constraints/protocols.swift index 09969fce98c..09d3a67724c 100644 --- a/test/Constraints/protocols.swift +++ b/test/Constraints/protocols.swift @@ -71,7 +71,7 @@ func castToClass(object: Any) -> SomeArbitraryClass? { return object as? SomeArbitraryClass } -getAnyObject().map(castToClass) // expected-error{{function signature '(Any) -> SomeArbitraryClass?' is not compatible with expected type '(AnyObject) throws -> SomeArbitraryClass?'}} expected-note {{use a closure to safely wrap calls to the function}} {{20-20={ }} {{31-31=($0) }}} +getAnyObject().map(castToClass) // expected-error{{function signature '(Any) -> SomeArbitraryClass?' is not compatible with expected type '(AnyObject) -> SomeArbitraryClass?'}} expected-note {{use a closure to safely wrap calls to the function}} {{20-20={ }} {{31-31=($0) }}} _ = { (_: Any) -> Void in // expected-error {{function signature 'Any -> Void' is not compatible with expected type '(Int) -> Void'}} diff --git a/test/IDE/complete_from_stdlib.swift b/test/IDE/complete_from_stdlib.swift index eb6c6bdaaac..d1c7b02dc5e 100644 --- a/test/IDE/complete_from_stdlib.swift +++ b/test/IDE/complete_from_stdlib.swift @@ -67,7 +67,7 @@ func protocolExtCollection2 T##(Self.Generator.Element) -> T#})[#[T]#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_3-DAG: Decl[InstanceVar]/Super: last[#Self.Generator.Element?#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_3-DAG-NOT: Decl{{.*}}: indexOf({#({{.*}}): Self.Generator.Element -// PRIVATE_NOMINAL_MEMBERS_3-DAG: Decl[InstanceMethod]/Super: indexOf({#({{.*}}): (Self.Generator.Element) throws -> Bool##(Self.Generator.Element) throws -> Bool#})[' rethrows'][#Self.Index?#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_3-DAG: Decl[InstanceMethod]/Super: indexOf({#({{.*}}): (Self.Generator.Element) -> Bool##(Self.Generator.Element) -> Bool#})[#Self.Index?#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_3: End completions func protocolExtArray(a: [T]) { @@ -77,5 +77,5 @@ func protocolExtArray(a: [T]) { // PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super: map({#({{.*}}): (Self.Generator.Element) -> T##(Self.Generator.Element) -> T#})[#[T]#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceVar]/Super: last[#Self.Generator.Element?#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super: indexOf({#({{.*}}): Self.Generator.Element#})[#Self.Index?#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super: indexOf({#({{.*}}): (Self.Generator.Element) throws -> Bool##(Self.Generator.Element) throws -> Bool#})[' rethrows'][#Self.Index?#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super: indexOf({#({{.*}}): (Self.Generator.Element) -> Bool##(Self.Generator.Element) -> Bool#})[#Self.Index?#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_4: End completions diff --git a/test/IDE/complete_literal.swift b/test/IDE/complete_literal.swift index 9d24874f290..299118b39e1 100644 --- a/test/IDE/complete_literal.swift +++ b/test/IDE/complete_literal.swift @@ -37,7 +37,7 @@ } // LITERAL4: Begin completions -// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: withCString({#(f): UnsafePointer throws -> Result##UnsafePointer throws -> Result#})[' rethrows'][#Result#]; name=withCString(f: UnsafePointer throws -> Result) rethrows{{$}} +// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: withCString({#(f): UnsafePointer -> Result##UnsafePointer -> Result#})[#Result#]; name=withCString(f: UnsafePointer -> Result){{$}} // FIXME: we should show the qualified String.Index type. // rdar://problem/20788802 diff --git a/test/SILPasses/devirt_jump_thread_crasher.sil b/test/SILPasses/devirt_jump_thread_crasher.sil index aaec3a15343..b07b6514ad1 100644 --- a/test/SILPasses/devirt_jump_thread_crasher.sil +++ b/test/SILPasses/devirt_jump_thread_crasher.sil @@ -1,10 +1,8 @@ // RUN: %target-sil-opt %s -simplify-cfg -verify | FileCheck %s -// XFAIL: * - // REQUIRES: objc_interop -// FIXME: this test relies on brittle standard library implementation details. -// rdar://problem/21988500 +// FIXME: this test relies on standard library implementation details that are +// only present with Objective-C runtime. // Check that this SIL compiles without crashes. See rdar://20345557 diff --git a/test/sil-opt/emit-sib.swift b/test/sil-opt/emit-sib.swift index d0513bbb085..ca414782a6b 100644 --- a/test/sil-opt/emit-sib.swift +++ b/test/sil-opt/emit-sib.swift @@ -1,13 +1,13 @@ // RUN: rm -rf %t && mkdir -p %t -// RUN: %target-swiftc_driver -emit-sib %s -module-name test -assert-config Release -O -o %t/a-opt.sib -// RUN: %target-swiftc_driver -emit-ir %t/a-opt.sib -module-name test -assert-config Release -o %t/test.ll +// RUN: %target-swiftc_driver -emit-sib %s -module-name test -O -o %t/a-opt.sib +// RUN: %target-swiftc_driver -emit-ir %t/a-opt.sib -module-name test -o %t/test.ll // RUN: mv %t/test.ll %t/a-test.ll -// RUN: %target-swiftc_driver -emit-sibgen %s -module-name test -assert-config Release -o %t/b-sibgen.sib -// RUN: %target-sil-opt -emit-sib %t/b-sibgen.sib -module-name test -assert-conf-id=1 -diagnostics -o %t/b-sibgen-diag.sib -// RUN: %target-sil-opt -emit-sib %t/b-sibgen-diag.sib -module-name test -assert-conf-id=1 -O -o %t/b-opt.sib -// RUN: %target-swiftc_driver -emit-ir %t/b-opt.sib -module-name test -assert-config Release -o %t/test.ll +// RUN: %target-swiftc_driver -emit-sibgen %s -module-name test -o %t/b-sibgen.sib +// RUN: %target-sil-opt -emit-sib %t/b-sibgen.sib -module-name test -diagnostics -o %t/b-sibgen-diag.sib +// RUN: %target-sil-opt -emit-sib %t/b-sibgen-diag.sib -module-name test -O -o %t/b-opt.sib +// RUN: %target-swiftc_driver -emit-ir %t/b-opt.sib -module-name test -o %t/test.ll // RUN: mv %t/test.ll %t/b-test.ll // RUN: cmp %t/a-test.ll %t/b-test.ll