-
Notifications
You must be signed in to change notification settings - Fork 103
Implement an overload of confirmation()
that takes an unbounded range.
#598
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unbounded ranges are not meaningful when used with `confirmation()` because _any_ confirmation count matches. As well, the `...` operator produces an instance of `UnboundedRange` which is a non-nominal type and cannot conform to `RangeExpression`. It may be non-obvious to a developer why `...` doesn't work as the `expectedCount` argument to that function when other range operators work as expected. This PR implements a stub overload of `confirmation()` that takes an unbounded range. The stub overload is marked unavailable and cannot be called.
@swift-ci please test |
grynspan
commented
Aug 2, 2024
@@ -188,7 +188,7 @@ enum Environment { | |||
return nil | |||
case let errorCode: | |||
let error = Win32Error(rawValue: errorCode) | |||
fatalError("unexpected error when getting environment variable '\(name)': \(error) (\(errorCode))") | |||
fatalError("Unexpected error when getting environment variable '\(name)': \(error) (\(errorCode))") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by formatting tweak.
grynspan
commented
Aug 2, 2024
@@ -118,7 +118,7 @@ private func _createAvailabilityTraitExpr( | |||
return ".__unavailable(message: \(message), sourceLocation: \(sourceLocationExpr))" | |||
|
|||
default: | |||
fatalError("Unsupported keyword \(whenKeyword) passed to \(#function)") | |||
fatalError("Unsupported keyword \(whenKeyword) passed to \(#function). Please file a bug report at https://github.com/swiftlang/swift-testing/issues/new") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by amendment to fatal error message.
@swift-ci please test |
Self-reviewing (tsk.) |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unbounded ranges are not meaningful when used with
confirmation()
because any confirmation count matches. As well, the...
operator produces an instance ofUnboundedRange
which is a non-nominal type and cannot conform toRangeExpression
. It may be non-obvious to a developer why...
doesn't work as theexpectedCount
argument to that function when other range operators work as expected.This PR implements a stub overload of
confirmation()
that takes an unbounded range. The stub overload is marked unavailable and cannot be called.Example usage:
Generated diagnostic:
As a reminder, using a range expression with
confirmation()
is an experimental feature and has not been API-reviewed.Checklist: