Skip to content

Commit 91b392d

Browse files
committed
Pass along source context in dispatchPrecondition
`dispatchPrecondition` is great, but it lacks file/line parameters ...
1 parent afa6cc3 commit 91b392d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/swift/Dispatch.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public func _dispatchPreconditionTest(_ condition: DispatchPredicate) -> Bool {
3838

3939
@_transparent
4040
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
41-
public func dispatchPrecondition(condition: @autoclosure () -> DispatchPredicate) {
41+
public func dispatchPrecondition(condition: @autoclosure () -> DispatchPredicate, file: StaticString = #file, line: UInt = #line) {
4242
// precondition is able to determine release-vs-debug asserts where the overlay
4343
// cannot, so formulating this into a call that we can call with precondition()
44-
precondition(_dispatchPreconditionTest(condition()), "dispatchPrecondition failure")
44+
precondition(_dispatchPreconditionTest(condition()), "dispatchPrecondition failure", file: file, line: line)
4545
}
4646

4747
/// qos_class_t

0 commit comments

Comments
 (0)