Commit bba4bdf
authored
Implement an overload of
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.
Example usage:
```swift
await confirmation("Stuff happens", expectedCount: ...) { stuff in
// ...
}
```
Generated diagnostic:
> 🛑 'confirmation(\_:expectedCount:sourceLocation:\_:)' is unavailable:
Unbounded range '...' has no effect when used with a confirmation.
As a reminder, using a range expression with `confirmation()` is an
experimental feature and has not been API-reviewed.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.confirmation() that takes an unbounded range. (#598)1 parent 8534698 commit bba4bdf
File tree
3 files changed
+18
-2
lines changed- Sources
- TestingMacros/Support
- Testing
- Issues
- Support
3 files changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
182 | 198 | | |
183 | 199 | | |
184 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
0 commit comments