Commit 3ee5ec0
authored
Lower the "ambiguous display name" diagnostic to a warning for some names. (#1175)
This PR modifies the behaviour of this compile-time macro diagnostic:
> 🛑 "Attribute 'Test' specifies display name 'foo' for function with
implicit display name 'bar'
If `bar` (in the above context) is _not_ considered a raw identifier by
the language, we emit a warning instead of an error. This will allow us
to adjust display-name-from-backticked-name inference (see #1174)
without introducing a source-breaking change for a declaration such as:
```swift
@test("subscript([K]) operator")
func `subscript`()
```
(The above is a real-world test function in our own package that would
be impacted.)
Note that we don't actually have a code path that triggers this warning
yet. #1174, if approved and merged, would introduce such a code path.
Here's an example of what that would look like:
<img width="774" alt="Screenshot showing the warning diagnostic
presented for func subscript()"
src="https://github.com/user-attachments/assets/ee8ff23c-8cbb-4335-af36-24a54deac6cc"
/>
### 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 a208154 commit 3ee5ec0
File tree
2 files changed
+11
-4
lines changed- Sources/TestingMacros/Support
2 files changed
+11
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
147 | 149 | | |
148 | | - | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
660 | | - | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
661 | 667 | | |
662 | | - | |
663 | | - | |
| 668 | + | |
| 669 | + | |
664 | 670 | | |
665 | 671 | | |
666 | 672 | | |
| |||
0 commit comments