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

default(SyntaxToken).ValueText could return an empty string #41304

Closed
sharwell opened this issue Jan 30, 2020 · 1 comment · Fixed by #41313
Closed

default(SyntaxToken).ValueText could return an empty string #41304

sharwell opened this issue Jan 30, 2020 · 1 comment · Fixed by #41313
Labels
Area-Compilers Concept-API This issue involves adding, removing, clarification, or modification of an API. Concept-Null Annotations The issue involves annotating an API for nullable reference types Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@sharwell
Copy link
Member

Version Used: 1b4b5ba

Steps to Reproduce:

default(SyntaxToken).ValueText

Expected Behavior:

Returns "".

Actual Behavior:

Returns null.

This is the only situation where SyntaxToken.ValueText returns null, and it forces the property itself to have type string? instead of string. If we update the return value for this case, the property no longer needs to be nullable.

@sharwell sharwell added Concept-API This issue involves adding, removing, clarification, or modification of an API. Area-Compilers Concept-Null Annotations The issue involves annotating an API for nullable reference types labels Jan 30, 2020
@CyrusNajmabadi
Copy link
Member

I'm in favor of this. We already return "" for things that don't actually have values (i.e. operators/keywords/etc.). So being "" for all tokens without values would be very nice.

sharwell added a commit to sharwell/roslyn that referenced this issue Jan 31, 2020
@sharwell sharwell added the Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented label Jan 31, 2020
@sharwell sharwell added this to the 16.5.P3 milestone Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Concept-API This issue involves adding, removing, clarification, or modification of an API. Concept-Null Annotations The issue involves annotating an API for nullable reference types Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants