How does one correct shadowing (hidden by) errors?

Tyro[a.c.edwards] nospam at home.com
Fri Jul 22 17:30:06 PDT 2011


While attempting to build the DFL libraries, I encountered the following 
three errors:

[1] tabcontrol.d(18): Error: class dfl.tabcontrol.TabPage use of 
dfl.control.Control.opEquals(Control ctrl) hidden by TabPage is deprecated

[2] tabcontrol.d(18): Error: class dfl.tabcontrol.TabPage use of 
dfl.control.Control.opCmp(Control ctrl) hidden by TabPage is deprecated

[3] imagelist.d(22): Error: class 
dfl.imagelist.ImageList.ImageCollection use of 
dfl.imagelist.ImageList.ImageCollection.ListWrapArray!(Image,_images,_adding,_added,_blankListCallback,_removed,false,false,false).insert(int 
index, Image value) hidden by ImageCollection is deprecated

Now I know I can bypass this with the -d switch but I'm more interested 
in fixing the problem than bypassing it.

Control defines the following two functions:

	override Dequ opEquals(Object o)
	{
		Control ctrl = cast(Control)o;
		if(!ctrl)
			return 0; // Not equal.
		return opEquals(ctrl);
	}

	override int opCmp(Object o)
	{
		Control ctrl = cast(Control)o;
		if(!ctrl)
			return -1;
		return opCmp(ctrl);
	}
	
Whereas TabPage defines the following:

	override Dequ opEquals(Object o)
	{
		return text == getObjectString(o);
	}

	override int opCmp(Object o)
	{
		return stringICmp(text, getObjectString(o));
	}

How does one correct this such that the latter does not hide the first?

Problem [3] on the other hand is caused by a template mixin in the 
dfl.imagelist.ImageList.ImageCollection. ImageCollection is not a 
derived class so I do not understand what is being hidden. Please 
explain. Also, a suggestion on how to correct the issue would be 
helpful. The code is as follows:

class ImageList
{
	class ImageCollection
	{
		...
		public:
		mixin ListWrapArray!(Image, _images,
			_adding, _added,
			_blankListCallback!(Image), _removed,
			false, false, false);
	}
	...
}

Thanks


More information about the Digitalmars-d-learn mailing list