Bug 24234 – suggest imports of known/processed symbols

Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-11-08T19:00:12Z
Last change time
2024-12-13T19:31:39Z
Assigned to
No Owner
Creator
Steven Schveighoffer
Moved to GitHub: dmd#20354 →

Comments

Comment #0 by schveiguy — 2023-11-08T19:00:12Z
Let's say you have a local module `foo` with a symbol `bar`. You also have another module `baz`, which uses `bar` but does not import `foo`. Something like: ```d module foo; int bar() { return 5; } ``` ```d module baz; int fn() { return bar(); } // error, bar not defined ``` For known functions/symbols, the compiler suggests imports. If you are missing an import for `std.stdio`, and you use `writeln`, the compiler suggests the import. But often times, you are compiling *both* `foo` and `baz`, and so the compiler knows there is a `bar`, and it can be accessed by importing `foo`. If you are already ending compilation anyway, why not give suggestions for the known symbol? You can even suggest multiple places where the symbol is defined if that is the case.
Comment #1 by robert.schadek — 2024-12-13T19:31:39Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20354 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB