-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[stackalloc-init] Improve error tolerance when parsing invalid implicit stackalloc arrays #24914
Conversation
The error message should probably be changed. I'll wait for review feedback before changing it. |
Agreed. |
@jinujoseph Shouldn't this be assigned to the compiler team instead of me? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks
LGTM, but we need a better error. Any good ideas? Example of where the current error might sound strange:
|
I think the error message we use elsewhere is something like "expected ]". Maybe that's better? |
@jcouv - just to clarify, are you suggesting simply putting an error on the first unexpected token and produce some standard " expected ']' " ? Considering that the stackalloc is a fairly advanced feature, this would seem sufficient. |
Yes, that's what I was suggesting. For context, here's the error we just added for implicit array creation (https://github.com/dotnet/roslyn/pull/24706/files#diff-0d8acdaeed6fd4e02198f6e3745d6d2dR286): "Invalid rank specifier: expected ',' or ']'". For stackalloc ( |
to be clear, should this be a new error or we should update the existing one? |
@alrz It seems that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VSadov There are two reviews of this PR now. |
I should add the new error. will push it asap. |
a386c51
to
bff2d1c
Compare
@@ -5256,4 +5256,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ | |||
<data name="IDS_FeatureStackAllocInitializer" xml:space="preserve"> | |||
<value>stackalloc initializer</value> | |||
</data> | |||
<data name="ERR_InvalidStackAllocArray" xml:space="preserve"> | |||
<value>"Invalid rank specificier: expected ']'</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specificier [](start = 25, length = 11)
"specificier"??? I think this is a typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM
Thanks!
No description provided.