You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include fix-its in the diagnostic on a parameterized test when @Test is missing arguments: (#450)
This adds fix-its to the diagnostic emitted by the `@Test` macro when it
has been applied to a function which includes parameters but does not
specify `arguments: ...`.
### Motivation:
When transforming a non-parameterized `@Test` function into a
parameterized one, it's common to begin by adding one or more parameters
to the function's signature. Immediately after doing that, the `@Test`
macro emits an error diagnostic if `arguments:` is not passed to
`@Test`. Since this is a common workflow and it may not always be
obvious to new users where to add `arguments:`, it would be beneficial
for this diagnostic to include a fix-it.
### Modifications:
- Add a couple of styles of fix-it to this diagnostic, with variations
for single- and multiple-parameter functions.
- Enhance a utility on `EditorPlaceholderExprSyntax` to prefer typed
placeholders (see code comment).
### 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.
Resolves rdar://128396593
message:"Attribute \(_macroName(attribute)) cannot specify arguments when used with '\(functionDecl.completeName)' because it does not take any",
444
+
message:"Attribute \(_macroName(attribute)) cannot specify arguments when used with function '\(functionDecl.completeName)' because it does not take any",
446
445
severity:.error
447
446
)
448
-
case1:
447
+
}else{
449
448
returnSelf(
450
449
syntax:Syntax(functionDecl),
451
-
message:"Attribute \(_macroName(attribute)) must specify an argument when used with '\(functionDecl.completeName)'",
452
-
severity:.error
450
+
message:"Attribute \(_macroName(attribute)) must specify arguments when used with function '\(functionDecl.completeName)'",
0 commit comments