D_Parser icon indicating copy to clipboard operation
D_Parser copied to clipboard

UFCS does not work with pointer arguments

Open rainers opened this issue 5 years ago • 0 comments

Reported by Manu: Goto-Definition does not work with UFCS and pointer types, e.g.

inout(char)[] asDString(const(char)* cstr) pure nothrow @nogc @trusted
{
    return null;
}

const(char)* pixelFormat;

@property const(char)[] format() const pure nothrow @nogc @safe
{
    return pixelFormat.asDString(); // no definiton found for "asDString"
}

asDString(pixelFormat) works as expected. Looks like it already dereferences the pointer before UFCS lookup. If I add an overload for const char it is found as definition:

inout(char)[] asDString(const char cstr) pure nothrow @nogc @trusted
{
    return null;
}

Another issue seems to be that mutable char is not considered as a matching overload.

rainers avatar Apr 17 '19 06:04 rainers