[Issue 19456] New: ParameterIdentifierTuple incorrect for abstract methods with unnamed parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 30 22:42:07 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19456

          Issue ID: 19456
           Summary: ParameterIdentifierTuple incorrect for abstract
                    methods with unnamed parameters
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: johnch_atms at hotmail.com

ParameterIdentifierTuple returns incorrect results for abstract methods on
classes and interfaces.

class SomeClass {
  abstract void first(SomeClass);
  abstract void second(int);
  void third(SomeClass) {}
}

pragma(msg, ParameterIdentifierTuple!(__traits(getMember, SomeClass, "first"));
// outputs: tuple("SomeClass")
pragma(msg, ParameterIdentifierTuple!(__traits(getMember, SomeClass,
"second")); // outputs: tuple("")
pragma(msg, ParameterIdentifierTuple!(__traits(getMember, SomeClass, "third"));
// outputs: tuple("_param_0")

ParameterIdentifierTuple uses __traits(identifier,...) under the hood, and it
looks like that's ultimately where the issue is. ParameterIdentifierTuple on
non-abstract methods always seems to produce "_param_0", "_param_1" and so on.
However, I'd expect to see a tuple of empty strings in all three cases.

--


More information about the Digitalmars-d-bugs mailing list