How does one correct shadowing (hidden by) errors?
Tyro[a.c.edwards]
nospam at home.com
Sat Jul 23 18:48:35 PDT 2011
On 7/23/2011 7:49 PM, bearophile wrote:
> Tyro[a.c.edwards]:
>
>> [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.
>
> There is a trick based on explicit alias to avoid those errors. I'd like the idea of using this alias to be present in that error message...
>
> Bye,
> bearophile
Please do share. I thought the concept explicit alias simply requires me
to do his:
alias ListWrapArray LWA;
mixin LWA!(Image, _images,
_adding, _added,
_blankListCallback!(Image), _removed,
false, false, false);
This did not work... resulted in the same error. On closer look it seems
the actual problem is not the template but the definition of "insert"
therein. It is being hidden by the definition of insert in ImageCollection.
ImageCollection definition:
void insert(int index, Image img)
{
if(index >= _images.length)
{
add(img);
}
else
{
assert(0, "Must add images to the end of the image list");
}
}
ListWrapArray definition:
void insert(int index, TValue value)
{
_insert(index, value);
}
In the end it turns out to be the same problem as one and two. Any
suggestion on how to deal with these correctly? I can resolve this
particular error by renaming the function to "Insert" in
ImageCollection. But even though it appeases the compiler, is that the
correct solution? Is there something else that I'm not taking into
consideration? How do I fix the other two since there is no way to
rename opApply and opCmp that I'm aware of?
Thanks
More information about the Digitalmars-d-learn
mailing list