dlang/visuald

Support shortened methods syntax

Closed this issue · 7 comments

desisma reported this on 2023-09-04T18:03:53Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=24136

CC List

  • arokhslade
  • r.sagitario

Description

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] dlang/phobos#8713

!!!There are attachements in the bugzilla issue that have not been copied over!!!

desisma commented on 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

desisma commented on 2023-09-04T18:13:54Z

(In reply to Elias Batek (0xEAB) from comment #1)

adding the switch doesn't change a thing

*change anything

arokhslade commented on 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.

arokhslade commented on 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.)

r.sagitario commented on 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.

I also have this issue

Should be fixed in https://github.com/dlang/visuald/releases/tag/v1.4.0-beta2 as the semantic engine is based on dmd 2.060.0.