D_Parser
D_Parser copied to clipboard
templated alias/enum does not capture arguments
Reported by Manu:
// cursor here ------------------> vvvvvvvvvvv and press F12
alias isValidPixelType(ElementType) = ElementType;
// cursor moves to here:
template ElementType(Img) // <- except the cursor goes to the start of the line rather than the proper token
{
alias ElementType = void;
}
// the cursor should move to the template argument for the template it's in, not some other declaration with the same name
//===========================================================================================================================================
//===========================================================================================================================================
// cursor here -----------------> vvvvvvvvvvvv and press F12
enum isValidPixelType(ElementType2) = ElementType2;
template ElementType2() // <- note that I removed the template argument
{
alias ElementType2 = void;
}
// the cursor no longer moves anywhere
//===========================================================================================================================================
//===========================================================================================================================================
template ElementType3(Img) // <========= To the declaration
{
// cursor here and press F12
// vvvvvvvvvvvv
alias ElementType3 = void;
}
//
// I feel like it should move to here ===//
(Not so sure what should happen in the third case). Seems like the template arguments of the alias/enum definitions are ignored in symbol lookup.
The 3rd case feels controversial. but I feel like it would make sense for the definition of the template value to lead back to the template declaration (the first line).. I doubt that has any knock-on effects, whereas I suspect the first 2 cases may lead to more complex interactions in other cases.