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

No syntax error when VB compiler generates skipped tokens for nullable ? syntax inside cref #2196

Open
shyamnamboodiripad opened this issue Apr 23, 2015 · 0 comments
Assignees
Labels
Area-Compilers Bug Concept-API This issue involves adding, removing, clarification, or modification of an API. help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@shyamnamboodiripad
Copy link
Contributor

When I type the below code and turn on xml doc comment generation in the project settings, I noticed that ? is actually parsed as a skipped token - which indicates that the syntax was erroneous. Yet the compiler gives me no warning (which means that the cref will not be emitted correctly).

capture3

capture

  • If I replace Integer? with Nullable(Of Integer), there is no longer any skipped tokens and no errors either. However, I am not sure whether this is legal - in C# we only allow unconstructed generic types in crefs (except when specifying parameter types) - so it is legal to say <see cref="Nullable{T}"/> but it is not legal to say <see cref="Nullable{Integer}"/>. In any case, if I inspect symbols for Nullable(Of Integer) and Integer using the syntax visualizer, I can see that both identifiers bind correctly (see screenshot below). So I guess this must be legal in VB.
  • But if this is legal in VB, then shouldn't using the short form syntax Integer? be legal too? Why does the parser skip the ? token? And why doesn't it produce any errors if this is illegal.

capture2

  • The specific reason I am logging this issue is that this inconsistent behavior makes detection of when we should offer to simplify Nullable(Of Something) to Something? within crefs in VB quite difficult. (Looks like VB is inconsistent with C# here + the VB compiler is also inconsistent with itself w.r.t interchangeability of short and long form syntax for nullables.) But this also feels like it would impact any tools / extensions that want to do analysis within crefs.
@gafter gafter added this to the 1.1 milestone May 8, 2015
@jaredpar jaredpar self-assigned this Jul 31, 2015
@gafter gafter modified the milestones: 1.2, 1.1 Aug 15, 2015
@jaredpar jaredpar modified the milestones: 2.0, 1.2 Nov 30, 2015
@gafter gafter modified the milestones: 2.0 (Preview 1), 2.0 (RC) Jun 20, 2016
@jaredpar jaredpar modified the milestones: 2.0 (RC), 2.1 Jul 19, 2016
@jaredpar jaredpar added Concept-API This issue involves adding, removing, clarification, or modification of an API. help wanted The issue is "up for grabs" - add a comment if you are interested in working on it labels Feb 7, 2017
@jaredpar jaredpar modified the milestones: Unknown, 2.1 Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Concept-API This issue involves adding, removing, clarification, or modification of an API. help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
None yet
Development

No branches or pull requests

3 participants