dotnet/roslyn
View on GitHubWRN_ParamsArrayInLambdaOnly doesn't have single quotes around its argument.
Open
#66,389 opened on Jan 12, 2023
Area-CompilersConcept-Diagnostic Clarityhelp wanted
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (Avg merge 6d 17h) (256 merged PRs in 30d)
Description
<data name="WRN_ParamsArrayInLambdaOnly" xml:space="preserve">
<value>Parameter {0} has params modifier in lambda but not in target delegate type.</value>
</data>
This is inconsistent with other diagnostics that we produce. Also the arguments blends in in the message. For example:
// (67,49): warning CS9100: Parameter 1 has params modifier in lambda but not in target delegate type.
// Action<string[]> q17 = (params string[] s)=>{};
Diagnostic(ErrorCode.WRN_ParamsArrayInLambdaOnly, "s").WithArguments("1").WithLocation(67, 49),
Another aspect to consider is, if we always use parameter number for the argument, then it might make sense to include the word "number" into the message. Number "1" could easily be confused with letter "l", for example, and interpreted as a name instead.