[Issue 24476] New: Show error for missing import path

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 1 09:46:01 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24476

          Issue ID: 24476
           Summary: Show error for missing import path
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: tim.dlang at t-online.de

When a module can't be found, DMD will currently show an error message like
this:
```
dmd -Itestpackage test.d

test.d(1): Error: unable to read module `testmodule`
test.d(1):        Expected 'testmodule.d' or 'testmodule/package.d' in one of
the following import paths:
import path[0] = testpackage
import path[1] = /usr/include/dlang/dmd
```

In this case the directory `testpackage` does not exist, but that is not
visible from the error message.

It would be helpful to directly show an error message when parameter
`-Itestpackage` is used, but directory `testpackage` does not exist.
Unfortunately that could break existing projects.

Alternatively the error message for a missing module could be improved like
this:
```
test.d(1): Error: unable to read module `testmodule`
test.d(1):        Expected 'testmodule.d' or 'testmodule/package.d' in one of
test.d(1): Error: import path 'testpackage' does not exist
the following import paths:
import path[0] = testpackage
import path[1] = /usr/include/dlang/dmd
```

--


More information about the Digitalmars-d-bugs mailing list