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

--- Comment #13 from Timothee Cour <timothee.co...@gmail.com> ---
I don't see what's controversial about the fact that this is broken and breaks
the module system.

Hopefully this other example will convince you, where all I do is change the
order of imports and goes from CT error to compiling.


./main.d
pragma(msg, __FILE__," ",__MODULE__);
import foo.bar;
import foo.bar2;

version(A){
import foo.bar4;
import foo.bar3;
}
else version(B){
import foo.bar3;
import foo.bar4;
}


void main(){}
./foo/bar2.d
module foo.bar2;
pragma(msg, __FILE__," ",__MODULE__);
./foo/bar4.d
module foo.bar4;
pragma(msg, __FILE__," ",__MODULE__);

import asdf.wrong;

./foo/bar.d
pragma(msg, __FILE__," ",__MODULE__);
./foo/bar3.d
module asdf.wrong;
pragma(msg, __FILE__," ",__MODULE__);

./asdf/wrong.d
pragma(msg, __FILE__," ",__MODULE__);

```
dmd -version=A -run main.d
main.d(7): Error: module `asdf.wrong` from file foo/bar3.d conflicts with
another module wrong from file asdf/wrong.d

dmd -version=B -run main.d
main.d main
foo/bar.d bar
foo/bar2.d foo.bar2
foo/bar3.d asdf.wrong
foo/bar4.d foo.bar4
```


This causes many other weirdnesses:
* seperate compilation vs all-at-once compilation is broken
* this makes `./foo/bar.d` and `foo/bar.d` appear as different paths:

```
dmd foo/bar.d -run main.d
main.d(2): Error: module `bar` from file foo/bar.d must be imported with
'import bar;'
dmd ./foo/bar.d -run main.d
main.d(2): Error: module `bar` from file foo/bar.d conflicts with another
module bar from file ./foo/bar.d
```

--

Reply via email to