serve-d icon indicating copy to clipboard operation
serve-d copied to clipboard

serve-d complains when on assignment in conditional expression

Open vabenil opened this issue 2 years ago • 4 comments

Description

Serve-d tells me that the code below should result in an Error despite it compiling fine. 2022-06-03_10:55:50

Setup

  • Arch Linux
  • neovim 0.7.0
  • nvim-lspconfig
  • serve-d - latest version as of June 03 2022 (Also tested with stable 7.4v release)

Steps to reproduce

  1. Create a sample project with dub
  2. insert this code in source/app.d
import std : writeln, format;

void main()
{
    int i = 10;
    // Silly example I know
    while (int not_four = (i != 4)) {
        writeln(format("%d is not 4!", i));
        i--;
    }
}

vabenil avatar Jun 03 '22 08:06 vabenil

this actually seems to be new syntax since 2.097.2 that you are allowed to use variable declarations as conditions inside while loops that's not yet supported in libdparse: https://dlang.org/changelog/2.097.0.html#while-condition-assignment

WebFreak001 avatar Jun 03 '22 08:06 WebFreak001

Should I open an issue in libdparse then?

vabenil avatar Jun 03 '22 08:06 vabenil

yes, should be fixed soon too

WebFreak001 avatar Jun 03 '22 09:06 WebFreak001

(still needs libdparse update here)

WebFreak001 avatar Jun 20 '22 17:06 WebFreak001

libdparse has been updated here already. The only thing we are missing is a release. We can close this already, no?

vabenil avatar Nov 24 '22 11:11 vabenil

yep, stable release is in preparation and dependencies are updated as well

WebFreak001 avatar Nov 24 '22 14:11 WebFreak001