Disallow empty statements made by semicolons#6886
Conversation
src/ddmd/parse.d
Outdated
| if (f.frequire || f.fensure) | ||
| error("missing body { ... } after in or out"); | ||
| f.fbody = parseStatement(PSsemi); | ||
| f.fbody = parseStatement(0); |
There was a problem hiding this comment.
I was going to make a new enum value PSdefault or so, but I saw parseStatement called with 0 in other places as well, so I left it like this.
8780ce4 to
c03d4ca
Compare
src/ddmd/parse.d
Outdated
| warning(loc, "use '{ }' for an empty statement, not a ';'"); | ||
| else | ||
| error("use '{ }' for an empty statement, not a ';'"); | ||
| error("use '{ }' for an empty statement, not a ';'"); |
There was a problem hiding this comment.
You cant pass from warning to error. There must be a deprecation period before.
|
This must go through a period of time where it is deprecated first. |
|
Ah, true. I got mislead by the compiler's source, which states this is deprecated (See the |
Creating empty statements using semicolons, for which was previously issued a warning is now causing a deprecation hint.
There were places in the tests where the empty statements
were produces, which is now a compilation error. This removes/replaces
all of them with {}.
|
Changed to a deprecation. |
|
I'm not sure what's up with Jenkins, but he also failed in the trivial #6891 PR |
Yes, the Jenkins server was down for a week and now we are playing goose hunting for the introduced regressions in downstream projects, see e.g. dlang/phobos#5469 |
|
All clear, thanks! |
This turns the previous warning when using a semicolon
for an empty statement to a compilation error.