rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.91k stars 299 forks source link

Recent Grammar issues #6196

Closed tommy9 closed 8 months ago

tommy9 commented 8 months ago

Fixes for #6187, #6194

Single line if statements had been made too flexible, in particular the rule ifWithEmptyThen where all the elements following the THEN were optional, letting the singleLineIfStmt match what is really an ifStmt:

ifWithEmptyThen : IF whiteSpace? booleanExpression whiteSpace? THEN whiteSpace? emptyThenStatement? singleLineElseClause?;

Now the rule requires at least one of emptyThenStatement or singleLineElseClause.

The user defined type member rule has been modified to allow the asTypeClause to be omitted but only if the member is an array. This ensures valid (though not defined in the language specification) examples through as in #6187

optionalArrayClause : ((arrayDim whiteSpace)? asTypeClause | arrayDim);

rubberduck-vba-releasebot commented 8 months ago

:white_check_mark: Build Rubberduck 2.5.9.6317 completed (commit https://github.com/rubberduck-vba/Rubberduck/commit/80ad5e5400 by @tommy9)

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (22b5a72) 97.34% compared to head (c7b7d38) 97.58%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## next #6196 +/- ## ========================================== + Coverage 97.34% 97.58% +0.24% ========================================== Files 4 4 Lines 413 413 Branches 28 28 ========================================== + Hits 402 403 +1 Misses 6 6 + Partials 5 4 -1 ``` [see 1 file with indirect coverage changes](https://app.codecov.io/gh/rubberduck-vba/Rubberduck/pull/6196/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rubberduck-vba)
MDoerner commented 8 months ago

Thanks for working on the mess I caused. I would have liked to do it myself for a whole, but my real work is in crunch mode at the moment.

I think the fix actually does not address the full problem with the single line if statement. It certainly removes the rule confusion on multi-line if statements, but it does not address the resolver issue on single line if statements with empty then clauses. I think that is caused by me forgetting to put a null check into the method handling single line if statement contexts in the resolver when I made the one part optional. I believe that still needs to be added.

tommy9 commented 8 months ago

Thanks, I didn't think to change the lack of null checking because the grammar fix should mean it there should never be an empty else clause and an empty then clause. However, who knows what odd code could end up taking that path, so I agree it is safest to add a check in. I'll update the pull request.

rubberduck-vba-releasebot commented 8 months ago

:white_check_mark: Build Rubberduck 2.5.9.6318 completed (commit https://github.com/rubberduck-vba/Rubberduck/commit/604e240b47 by @tommy9)

pflugs30 commented 8 months ago

@retailcoder something is wrong with the release URL. When I try to download the updated build from the website for testing, I get a 404 on the redirect to Github. image

The link with the 404 is: https://github.com/rubberduck-vba/Rubberduck/releases/download/Prerelease-v2.5.9.6296/Rubberduck.Setup.2.5.9.6319-pre.exe

It should be: https://github.com/rubberduck-vba/Rubberduck/releases/download/**Prerelease-v2.5.9.6319**/Rubberduck.Setup.2.5.9.6319-pre.exe

(without the asterisks, of course :-) )

retailcoder commented 8 months ago

Argh, my bad - with the web API being down I'm manually inserting the records in the database... I messed that one up, will update over lunch (30-60 minutes)

retailcoder commented 8 months ago

Fixed!