Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter null checking needs to ensure testing for use in delegate parameters #58323

Closed
jaredpar opened this issue Dec 14, 2021 · 1 comment
Closed
Assignees
Labels
Area-Compilers Bug Feature - Param Null Checking untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@jaredpar
Copy link
Member

The following behavior is not allowed

delegate void D(string x!!);

Need to ensure tests are written to verify this (current behavior is correct).

@jaredpar jaredpar added this to the 17.2 milestone Dec 14, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Dec 14, 2021
jaredpar added a commit to jaredpar/roslyn that referenced this issue Dec 14, 2021
@jaredpar
Copy link
Member Author

This test exists so closing

public void NullCheckedDelegateDeclaration()
{
var source = @"
delegate void Del(string x!!, int y);
class C
{
Del d = delegate(string k!!, int j) { /* ... */ };
}";
CreateCompilation(source, parseOptions: TestOptions.RegularPreview).VerifyDiagnostics(
// (2,26): error CS8714: Parameter 'x' can only have exclamation-point null checking in implementation methods.
// delegate void Del(int x!!, int y);
Diagnostic(ErrorCode.ERR_MustNullCheckInImplementation, "x").WithArguments("x").WithLocation(2, 26));
}

jaredpar added a commit that referenced this issue Dec 15, 2021
* Resolve PROTOTYPE comments in param null checking

Filed the following issues:
- #58323
- #58322
- #58320

* Remove unnecessary issue link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Feature - Param Null Checking untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

2 participants