www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Strange type redifinition error

reply "Denis Koroskin" <2korden gmail.com> writes:
I am getting the following error message on one of my source files  
(D2.019):

Path.d(56): Error: Types.BOOL at Types.d(5) conflicts with  
win32.windef.BOOL at win32\windef.d(60)

win32\windef.d(60) looks like this:
alias int     WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;

Types.d(5) looks like this:
import win32.windef : BOOL;

Path.d includes lots of files that include both Types.d and win32\windef.d  
through a long inclusion chain.

Why does "import win32.windef : BOOL;" defines new type?
It is a bug, I guess. Removing ": BOOL;" solves the problem. Shall I put  
it into bugzilla?
Oct 08 2008
parent reply Benji Smith <dlanguage benjismith.net> writes:
Denis Koroskin wrote:
 I am getting the following error message on one of my source files 
 (D2.019):
 
 Path.d(56): Error: Types.BOOL at Types.d(5) conflicts with 
 win32.windef.BOOL at win32\windef.d(60)
 
 win32\windef.d(60) looks like this:
 alias int     WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;
 
 Types.d(5) looks like this:
 import win32.windef : BOOL;
 
 Path.d includes lots of files that include both Types.d and 
 win32\windef.d through a long inclusion chain.
 
 Why does "import win32.windef : BOOL;" defines new type?
 It is a bug, I guess. Removing ": BOOL;" solves the problem. Shall I put 
 it into bugzilla?

This sounds spookily familiar to a bug I logged last month. But I was using Tango, and it sounds like you're using Phobos. Here's my bug report: http://www.dsource.org/projects/tango/ticket/1249 This could be one of those cases where the same bits of code were copied and pasted into both Phobos and Tango, resulting in duplicate bugs. If you do post a bugzilla report, maybe add a link to the Tango bug. It might help. --benji
Oct 08 2008
next sibling parent reply torhu <no spam.invalid> writes:
Benji Smith wrote:
 Denis Koroskin wrote:
 I am getting the following error message on one of my source files 
 (D2.019):
 
 Path.d(56): Error: Types.BOOL at Types.d(5) conflicts with 
 win32.windef.BOOL at win32\windef.d(60)
 
 win32\windef.d(60) looks like this:
 alias int     WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;
 
 Types.d(5) looks like this:
 import win32.windef : BOOL;
 
 Path.d includes lots of files that include both Types.d and 
 win32\windef.d through a long inclusion chain.
 
 Why does "import win32.windef : BOOL;" defines new type?
 It is a bug, I guess. Removing ": BOOL;" solves the problem. Shall I put 
 it into bugzilla?

This sounds spookily familiar to a bug I logged last month. But I was using Tango, and it sounds like you're using Phobos. Here's my bug report: http://www.dsource.org/projects/tango/ticket/1249 This could be one of those cases where the same bits of code were copied and pasted into both Phobos and Tango, resulting in duplicate bugs. If you do post a bugzilla report, maybe add a link to the Tango bug. It might help.

I think it's a different issue. Selective imports work the same way as aliases. So in a way, BOOL is defined twice. If this is by design or accident, I don't know. import win32.windef : BOOL; is the same as: import win32.windef; alias win32.windef.BOOL BOOL;
Oct 08 2008
parent Benji Smith <dlanguage benjismith.net> writes:
torhu wrote:
 I think it's a different issue.  Selective imports work the same way as 
 aliases.  So in a way, BOOL is defined twice.  If this is by design or 
 accident, I don't know.
 
 import win32.windef : BOOL;
 
 is the same as:
 
 import win32.windef;
 alias win32.windef.BOOL BOOL;

Gotcha. I just didn't read the original post closely enough. --benji
Oct 08 2008
prev sibling parent "Denis Koroskin" <2korden gmail.com> writes:
Thanks to you all for your help!

On Wed, 08 Oct 2008 23:43:24 +0400, torhu <no spam.invalid> wrote:

 Benji Smith wrote:
 Denis Koroskin wrote:
 I am getting the following error message on one of my source files  
 (D2.019):
  Path.d(56): Error: Types.BOOL at Types.d(5) conflicts with  
 win32.windef.BOOL at win32\windef.d(60)
  win32\windef.d(60) looks like this:
 alias int     WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;
  Types.d(5) looks like this:
 import win32.windef : BOOL;
  Path.d includes lots of files that include both Types.d and  
 win32\windef.d through a long inclusion chain.
  Why does "import win32.windef : BOOL;" defines new type?
 It is a bug, I guess. Removing ": BOOL;" solves the problem. Shall I  
 put it into bugzilla?

using Tango, and it sounds like you're using Phobos. Here's my bug report: http://www.dsource.org/projects/tango/ticket/1249 This could be one of those cases where the same bits of code were copied and pasted into both Phobos and Tango, resulting in duplicate bugs. If you do post a bugzilla report, maybe add a link to the Tango bug. It might help.

I think it's a different issue. Selective imports work the same way as aliases. So in a way, BOOL is defined twice. If this is by design or accident, I don't know. import win32.windef : BOOL; is the same as: import win32.windef; alias win32.windef.BOOL BOOL;

Yes, but that doesn't create new type so no conflicts should be here. I filled the report: http://d.puremagic.com/issues/show_bug.cgi?id=2401
Oct 08 2008