Bug 24136 – Support shortened methods syntax

Status
NEW
Severity
major
Priority
P1
Component
visuald
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2023-09-04T18:03:53Z
Last change time
2023-10-18T20:22:37Z
Assigned to
No Owner
Creator
Elias Batek (0xEAB)
Moved to GitHub: visuald#240 →

Attachments

IDFilenameSummaryContent-TypeSize
1890visual-d with dmd.2.102.2.windows.PNGscreenshot: different error message on dmd 2.102.2image/png138129
1891visual-d with dmd.2.094.2.windows.PNGscreenshot: no error message on dmd 2.094.2image/png82210

Comments

Comment #0 by desisma — 2023-09-04T18:03:53Z
Visual D seems to lack support for the shortened methods syntax. This prevents a simple Hello World from compiling when the user has a recent copy of the Phobos src installed. That’s because VS doesn’t even to try compiling it when it runs into an error during code analysis, as it seems. Culprit appears to be Phobos PR #8713[0] which brought short.m.s to std.range. ArokhSlade from the community Discord reports that their project compiles fine when manually running the compiler via CLI. [0] https://github.com/dlang/phobos/pull/8713
Comment #1 by desisma — 2023-09-04T18:12:51Z
Error message: errors in imported modules: Error: C:\D\dmd2\src\phobos\std\range\package.d(1028): => shortened method not enabled, compile with compiler switch -preview=shortenedMethods ArokhSlade reports that… > adding the switch doesn't change a thing
Comment #2 by desisma — 2023-09-04T18:13:54Z
(In reply to Elias Batek (0xEAB) from comment #1) > > adding the switch doesn't change a thing *change anything
Comment #3 by arokhslade — 2023-09-04T19:57:10Z
Created attachment 1890 screenshot: different error message on dmd 2.102.2 screenshot shows the situation with dmd 2.102.2 a new solution & project in visual studio 2022 (17.7.3) produces different error messages but, i presume, similar issue. even complains about a file that neither was part of the solution nor opened in the workspace at all (but opened previously & closed). also shows compiling from cli works fine.
Comment #4 by arokhslade — 2023-09-04T20:01:46Z
Created attachment 1891 screenshot: no error message on dmd 2.094.2 this screenshot shows that the issue does not occur on an even older version of dmd (2.094.2). (also shows that compiling still fails, because visual-d doesn't know the right path to link.exe (and i don't know how to tell it) but i understand that's a separate issue.)
Comment #5 by r.sagitario — 2023-10-02T13:48:55Z
The errors shown are from intellisense. This is caused by the fact that the dmd-engine used for intellisense has not been updated in a while, but the imported files from phobos and druntime are newer. So it fails to recognize some constructs introduced by later dmd releases. Unfortunately, this also goes the other way: a newer engine might expect specific declaration/templates in the runtime that older versions don't have. The compilation is not affected (as long as the command line interface to dmd is not changed), the link error is caused by dmd 2.094 not knowing about VS 2022.
Comment #6 by robert.schadek — 2023-10-18T20:22:37Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/visuald/issues/240 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB