@@ -427,6 +427,92 @@ extension __ExpectationContext {
427427 }
428428}
429429
430+ // MARK: - Implicit pointer conversion
431+
432+ extension __ExpectationContext {
433+ /// Convert a mutable pointer to an immutable one and capture information
434+ /// about it for use if the expectation currently being evaluated fails.
435+ ///
436+ /// - Parameters:
437+ /// - value: The pointer to make immutable.
438+ /// - id: A value that uniquely identifies the represented expression in the
439+ /// context of the expectation currently being evaluated.
440+ ///
441+ /// - Returns: `value`, cast to an immutable pointer.
442+ ///
443+ /// This overload of `callAsFunction(_:_:)` handles the implicit conversion
444+ /// from a mutable to an immutable pointer that is normally provided by the
445+ /// compiler.
446+ ///
447+ /// - Warning: This function is used to implement the `#expect()` and
448+ /// `#require()` macros. Do not call it directly.
449+ public mutating func callAsFunction< T> ( _ value: UnsafeMutablePointer < T > , _ id: __ExpressionID ) -> UnsafePointer < T > {
450+ UnsafePointer ( self ( value, id) as UnsafeMutablePointer < T > )
451+ }
452+
453+ /// Convert an optional mutable pointer to an immutable one and capture
454+ /// information about it for use if the expectation currently being evaluated
455+ /// fails.
456+ ///
457+ /// - Parameters:
458+ /// - value: The pointer to make immutable, or `nil`.
459+ /// - id: A value that uniquely identifies the represented expression in the
460+ /// context of the expectation currently being evaluated.
461+ ///
462+ /// - Returns: `value`, cast to an immutable pointer.
463+ ///
464+ /// This overload of `callAsFunction(_:_:)` handles the implicit conversion
465+ /// from a mutable to an immutable pointer that is normally provided by the
466+ /// compiler.
467+ ///
468+ /// - Warning: This function is used to implement the `#expect()` and
469+ /// `#require()` macros. Do not call it directly.
470+ public mutating func callAsFunction< T> ( _ value: UnsafeMutablePointer < T > ? , _ id: __ExpressionID ) -> UnsafePointer < T > ? {
471+ UnsafePointer ( self ( value, id) as UnsafeMutablePointer < T > ? )
472+ }
473+
474+ /// Convert a mutable raw pointer to an immutable one and capture information
475+ /// about it for use if the expectation currently being evaluated fails.
476+ ///
477+ /// - Parameters:
478+ /// - value: The pointer to make immutable.
479+ /// - id: A value that uniquely identifies the represented expression in the
480+ /// context of the expectation currently being evaluated.
481+ ///
482+ /// - Returns: `value`, cast to an immutable raw pointer.
483+ ///
484+ /// This overload of `callAsFunction(_:_:)` handles the implicit conversion
485+ /// from a mutable to an immutable pointer that is normally provided by the
486+ /// compiler.
487+ ///
488+ /// - Warning: This function is used to implement the `#expect()` and
489+ /// `#require()` macros. Do not call it directly.
490+ public mutating func callAsFunction( _ value: UnsafeMutableRawPointer , _ id: __ExpressionID ) -> UnsafeRawPointer {
491+ UnsafeRawPointer ( self ( value, id) as UnsafeMutableRawPointer )
492+ }
493+
494+ /// Convert an optional mutable raw pointer to an immutable one and capture
495+ /// information about it for use if the expectation currently being evaluated
496+ /// fails.
497+ ///
498+ /// - Parameters:
499+ /// - value: The pointer to make immutable, or `nil`.
500+ /// - id: A value that uniquely identifies the represented expression in the
501+ /// context of the expectation currently being evaluated.
502+ ///
503+ /// - Returns: `value`, cast to an immutable raw pointer.
504+ ///
505+ /// This overload of `callAsFunction(_:_:)` handles the implicit conversion
506+ /// from a mutable to an immutable pointer that is normally provided by the
507+ /// compiler.
508+ ///
509+ /// - Warning: This function is used to implement the `#expect()` and
510+ /// `#require()` macros. Do not call it directly.
511+ public mutating func callAsFunction( _ value: UnsafeMutableRawPointer ? , _ id: __ExpressionID ) -> UnsafeRawPointer ? {
512+ UnsafeRawPointer ( self ( value, id) as UnsafeMutableRawPointer ? )
513+ }
514+ }
515+
430516#if !SWT_FIXED_122011759
431517// MARK: - String-to-C-string handling
432518
0 commit comments