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

Report misplaced unchecked in cref as warning #69609

Merged
merged 2 commits into from
Aug 22, 2023
Merged

Conversation

jcouv
Copy link
Member

@jcouv jcouv commented Aug 18, 2023

Fixes #69142

@jcouv jcouv self-assigned this Aug 18, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 18, 2023
@jcouv jcouv marked this pull request as ready for review August 18, 2023 20:31
@jcouv jcouv requested a review from a team as a code owner August 18, 2023 20:31
@@ -1129,7 +1129,8 @@ SyntaxToken tryEatCheckedOrHandleUnchecked(ref SyntaxToken operatorKeyword)
if (CurrentToken.Kind == SyntaxKind.UncheckedKeyword)
{
// if we encounter `operator unchecked`, we place the `unchecked` as skipped trivia on `operator`
var misplacedToken = this.AddError(this.EatToken(), ErrorCode.ERR_MisplacedUnchecked);
var code = ErrorCode.ERR_MisplacedUnchecked;
var misplacedToken = this.AddError(this.EatToken(), ErrorCode.WRN_ErrorOverride, new SyntaxDiagnosticInfo(code), (int)code);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a helper for this - AddErrorAsWarning

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jcouv jcouv requested a review from jjonescz August 21, 2023 18:15
@jcouv jcouv merged commit 57a0997 into dotnet:main Aug 22, 2023
@ghost ghost added this to the Next milestone Aug 22, 2023
@dibarbet dibarbet modified the milestones: Next, 17.8 P2 Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"error CS9027: Unexpected keyword 'unchecked'" is reported for cref syntax
4 participants