File tree Expand file tree Collapse file tree 2 files changed +19
-24
lines changed Expand file tree Collapse file tree 2 files changed +19
-24
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %target-typecheck-verify-swift
2+
3+ // https://github.com/apple/swift/issues/46000
4+
5+ struct DispatchData {
6+ let ptr : UnsafePointer < UInt8 >
7+ func withUnsafeBytes< Result, ContentType> ( body: ( UnsafePointer < ContentType > ) throws -> Result ) rethrows -> Result { try body ( ptr as! UnsafePointer < ContentType > ) }
8+ }
9+ struct Data { }
10+
11+ extension DispatchData {
12+ func asFoundationData< T> ( execute: ( Data ) throws -> T ) rethrows -> T {
13+ return try withUnsafeBytes { ( ptr: UnsafePointer < Int8 > ) -> Void in
14+ // expected-error@-1 {{cannot convert return expression of type 'Void' to return type 'T'}}
15+ let data = Data ( )
16+ return try execute ( data) // expected-error {{cannot convert value of type 'T' to closure result type 'Void'}}
17+ }
18+ }
19+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments