Get ArrayRankSpecifierSyntax where BracketedArgumentListSyntax is expected #31277
Labels
Area-Compilers
Bug
Concept-Diagnostic Clarity
The issues deals with the ease of understanding of errors and warnings.
Milestone
Version Used: 2.9.0
Steps to Reproduce:
Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript
with following code:Expected Behavior:
The Token kind should be BracketedArgumentListSyntax
Actual Behavior:
The kind of the token is ArrayRankSpecifierSyntax
The kind changes if you start writing an index value into the squared brackets.
e.g.: Writing
matrix[0]
and then retrieving the token yields the BracketedArgumentListSyntaxThe background is that I'm currently writing a completion provider for CSharp Scripts. When the user writes the opening bracket, the completion system shall provide with the required information e.g.:
Now the problem is that the token is only defined as BracketedArgumentListSyntax when the user already entered the first index and not when only the brackets are written.
Now the question is, is it expected (from a design point of view) that the token kind originally is ArrayRankSpecifierSyntax or is this a bug? It seems to make sense to me from the pure syntax-tree point of view, as it doesn't have the semantic context information to recognize the real type and recognize that it has an indexing operator. But on the other hand why does it then change when inserting a value into the brackets?
And why does it work for the second statement
double test = matrix[]
to immediately recognize this as the expected BracketedArgumentListSyntax when writing the brackets only?The text was updated successfully, but these errors were encountered: