Bug 9967 – ParameterIdentifierTuple broken for setters

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-20T03:45:00Z
Last change time
2013-07-22T17:36:11Z
Keywords
pull
Assigned to
nobody
Creator
public

Comments

Comment #0 by public — 2013-04-20T03:45:38Z
http://dpaste.1azy.net/c246a5c7 --- import std.traits; interface Test { @property void setter(int x); } pragma(msg, ParameterIdentifierTuple!(Test.setter)); void main() { } --- Compilation output: tuple("")
Comment #1 by public — 2013-04-20T04:34:42Z
Looks like not actually a phobos issue, but dmd/__parameters one: http://dpaste.1azy.net/a09afb96 --- interface Test { @property void setter(int x); } alias Type = typeof(&(Test.setter)); pragma(msg, Type); static if (is(Type PT == __parameters)) { pragma(msg, PT); } else pragma(msg, "Error!"); void main() {} --- Compilation output: void function(int x) @property Error! ---
Comment #2 by sludwig — 2013-04-29T02:55:41Z
__parameters seems to only with for actual function types and not for function pointers. Replacing "alias Type = typeof(&Test.setter);" with "alias Type = FunctionTypeOf!(Test.setter);" makes the bug example work. Similarly, replacing the first static-if in ParameterIdentifierTuple makes it work, but I'm unsure if this could break anything else: line 832 traits.d: --- static if (is(typeof!(func[0]) PT == __parameters)) +++ static if (is(FunctionTypeOf!(func[0]) PT == __parameters))
Comment #3 by public — 2013-04-29T03:07:32Z
Oh, neat, I have thought & and FunctionTypeOf are quite equivalent. It can be categorized as Phobos/ParameterIdentifierTuple issue then.
Comment #4 by yazan.dabain — 2013-06-30T12:29:23Z
Comment #5 by github-bugzilla — 2013-07-22T17:34:34Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/735d0e33c852fe691108c02241ba0129283f17cf Fixes issue #9967 - ParameterIdentifierTuple broken for setters https://github.com/D-Programming-Language/phobos/commit/8c2f4c512fe7518acd92b78dace4141e9d618702 Merge pull request #1378 from yazd/fix9967 Fix for issue #9967 - ParameterIdentifierTuple broken for setters