Skip to content

Commit bda514c

Browse files
Merge pull request #71364 from nate-chandler/test/20240202/1/bitwise-copyable-stdlib-types-1
[Test] Tested BitwiseCopyable for a few stdlib types.
2 parents 434a210 + 79e6cbf commit bda514c

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

test/Sema/bitwise_copyable.swift

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ func passInt(_ i: Int) { take3(i) }
144144

145145
func passTupleIntInt(_ t: (Int, Int)) { take3(t) }
146146

147+
func passFWI<T : FixedWidthInteger>(_ t: T) { take3(t) }
148+
147149
func passFloat(_ f: Float) { take3(f) }
148150

149151
func passAnyObject(_ o: AnyObject) { take3(o) } // expected-error {{type_does_not_conform_decl_owner}}
@@ -155,7 +157,7 @@ func passAny(_ a: Any) { take3(a) } // expected-error {{type_does_not_conform_de
155157
func passAnyAny(_ a: any Any) { take3(a) } // expected-error {{type_does_not_conform_decl_owner}}
156158

157159
func passString(_ s: String) { take3(s) } // expected-error {{type_does_not_conform_decl_owner}}
158-
// expected-note@-17 {{where_requirement_failure_one_subst}}
160+
// expected-note@-19 {{where_requirement_failure_one_subst}}
159161

160162
extension Optional where Wrapped : Copyable & Escapable {
161163
struct Some : _BitwiseCopyable & Copyable & Escapable {
@@ -191,6 +193,38 @@ struct S_Explicit_Nonescapable : ~Escapable, _BitwiseCopyable {} // expected-err
191193

192194
struct S_Explicit_Noncopyable : ~Copyable, _BitwiseCopyable {} // expected-error{{non_bitwise_copyable_type_noncopyable}}
193195

196+
func passUnmanaged<T : AnyObject>(_ u: Unmanaged<T>) { take3(u) }
197+
198+
struct S_Explicit_With_Unmanaged<T : AnyObject> : _BitwiseCopyable {
199+
var u: Unmanaged<T>
200+
}
201+
202+
func passUnsafePointer<T>(_ p: UnsafePointer<T>) { take3(p) }
203+
204+
struct S_Explicit_With_UnsafePointer<T> : _BitwiseCopyable {
205+
var ptr: UnsafePointer<T>
206+
}
207+
208+
func passUnsafeMutablePointer<T>(_ p: UnsafeMutablePointer<T>) { take3(p) }
209+
210+
struct S_Explicit_With_UnsafeMutablePointer<T> : _BitwiseCopyable {
211+
var ptr: UnsafeMutablePointer<T>
212+
}
213+
214+
func passUnsafeBufferPointer<T>(_ p: UnsafeBufferPointer<T>) { take3(p) }
215+
216+
struct S_Explicit_With_UnsafeBufferPointer<T> : _BitwiseCopyable {
217+
var ptr: UnsafeBufferPointer<T>
218+
}
219+
220+
func passUnsafeMutableBufferPointer<T>(_ p: UnsafeMutableBufferPointer<T>) { take3(p) }
221+
222+
struct S_Explicit_With_UnsafeMutableBufferPointer<T> : _BitwiseCopyable {
223+
var ptr: UnsafeMutableBufferPointer<T>
224+
}
225+
226+
func passPointer<T : _Pointer>(_ p: T) { take3(p) }
227+
194228
//==============================================================================
195229
//==========================STDLIB-DEPENDENCY TESTS=(END)=====================}}
196230
//==============================================================================

0 commit comments

Comments
 (0)