D_Parser
D_Parser copied to clipboard
When using string based case in switch statement, Parser indicates that CaseStatement is invalid
I'm attaching screenshot to visual the thing better.
I wasn't sure if I should post it here or in Mono-D project so here it is
well the switch statement is invalid: http://dlang.org/statement.html#string-switch
you are missing the case
keyword but ok the error message could be better...
this confused me a lot if switch-case-statements suddenly would not require 'case'-tokens anymore. Thus, I follow @Extrawurst's opinion - or does dmd allow such syntax?
@Extrawurst yeah, you are right.
Confusion came up because I wrongly thought that such construct is valid:
enum F : string {
A = "a"
...
}
F f;
with (F) switch (f)
{
A:
...
}
But now after thinking about it, these are just lexed as Labels in general.
So yeah, error report is invalid although it could be improvement request regarding error message itself