unittest compiles w/o error though module file is not named after the module

kdevel kdevel at vogtner.de
Sat Feb 6 14:36:15 UTC 2021


```p.d
module pp;

void foo ()
{
    import std.stdio: writeln;
    __PRETTY_FUNCTION__.writeln;
}
```
```x.d
import p;
```
```main.d
import x;
unittest {
    import pp: foo; // wrong name is accepted if x is imported
//   import p: foo;
    foo;
}
```

$ dmd -i -unittest -main -run main
void pp.foo()
1 unittests passed

Came across this while doing a comprehensive file renaming in a 
package.
I usually let me guide thru the codebase by the compile error 
messages.
However, make test unexpectedly succeeded though I have not yet 
adapted
all import directives.

Of course I could use git grep for this process but I would 
prefer that
the compilation would fail in the first place.


More information about the Digitalmars-d-learn mailing list