Thread overview
[Issue 23989] Regression in rdmd when running an empty eval
Jun 13, 2023
Richard Cattermole
Jun 13, 2023
deadalnix
Jun 13, 2023
mhh
Jun 14, 2023
Dlang Bot
Jun 14, 2023
Vladimir Panteleev
June 13, 2023
https://issues.dlang.org/show_bug.cgi?id=23989

Richard Cattermole <alphaglosined@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alphaglosined@gmail.com

--- Comment #1 from Richard Cattermole <alphaglosined@gmail.com> ---
Not a regression in rdmd.

In dmd 2.104.0 empty statements with semicolons now error.

https://dlang.org/changelog/2.104.0.html#dmd.empty-statement-error

You do not need anything passed to the eval flag and it would not emit the semicolon.

However in saying that, rdmd in innerEvalCode should be made smarter so that it checks if last character is either a semicolon or a close brace, rather than just a semicolon. That way loops can work.

https://github.com/dlang/tools/blob/master/rdmd.d#L875

I suppose making it even smarter with comment detection ext. would be good too.

--
June 13, 2023
https://issues.dlang.org/show_bug.cgi?id=23989

--- Comment #2 from deadalnix <deadalnix@gmail.com> ---
Something used to work.

Now it doesn't work.

None of the input provided contains either a `{}` or a `;`, so clearly the the user supplied code isn't at fault.

If rdmd generates something that is now invalid, then this is rdmd's problem.

It's 100% a regression.

--
June 13, 2023
https://issues.dlang.org/show_bug.cgi?id=23989

mhh <maxhaton@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxhaton@gmail.com

--- Comment #3 from mhh <maxhaton@gmail.com> ---
--eval containing a comment is pretty niche. Not entirely sure how to work around the empty statement problem. I assume it's to force evaluation because of the cache or something like that? If so then you might as well just s/rdmd/dmd because you basically gain 0 from rdmd other than it being slower.

rdmd does seem to have a test-suite though so we can add this to it.

--
June 14, 2023
https://issues.dlang.org/show_bug.cgi?id=23989

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@RazvanN7 created dlang/tools pull request #460 "Fix Issue 23989 - Regression in rdmd when running an empty eval" fixing this issue:

- Fix Issue 23989 - Regression in rdmd when running an empty eval

https://github.com/dlang/tools/pull/460

--
June 14, 2023
https://issues.dlang.org/show_bug.cgi?id=23989

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net

--- Comment #5 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
(In reply to deadalnix from comment #0)
> We run unit tests for modules in the following way:

Do you need a fix for this specific case? I don't think we can fix this general bug; we could add a hack that fixes this particular variation, but I think it only makes sense to do so if it helps someone in practice (see PR discussion).

--