Commit e63d542
authored
Diagnose when we incorrectly infer the type of a capture list item in an exit test. (#1152)
Follow-up to #1130, split out for clarity.
This PR adds a custom diagnostic at compile time if we incorrectly infer
the type of a captured function argument or `self` in an exit test. For
example:
```swift
func f(_ x: Int) async {
let x = String(x) // local type of 'x' is String, not Int
await #expect(processExitsWith: ...) { [x] in
...
}
}
```
This improves our feedback to the developer when we encounter a pattern
like that. The developer will now see:
> 🛑 Type of captured value 'x' is ambiguous
### 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.1 parent 66701fb commit e63d542
File tree
5 files changed
+61
-7
lines changed- Sources
- TestingMacros
- Support
- Testing/Expectations
- Tests/TestingTests
5 files changed
+61
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
| 583 | + | |
583 | 584 | | |
584 | 585 | | |
585 | 586 | | |
| |||
588 | 589 | | |
589 | 590 | | |
590 | 591 | | |
591 | | - | |
| 592 | + | |
| 593 | + | |
592 | 594 | | |
593 | 595 | | |
594 | 596 | | |
| |||
597 | 599 | | |
598 | 600 | | |
599 | 601 | | |
| 602 | + | |
600 | 603 | | |
601 | 604 | | |
602 | 605 | | |
| |||
606 | 609 | | |
607 | 610 | | |
608 | 611 | | |
609 | | - | |
| 612 | + | |
| 613 | + | |
610 | 614 | | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| 482 | + | |
482 | 483 | | |
483 | 484 | | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
488 | 492 | | |
489 | 493 | | |
490 | 494 | | |
| |||
0 commit comments