First life-signs of type functions
Stefan Koch
uplink.coder at googlemail.com
Wed May 27 12:56:32 UTC 2020
On Tuesday, 19 May 2020 at 14:48:31 UTC, Stefan Koch wrote:
> On Tuesday, 19 May 2020 at 14:42:25 UTC, Stefan Koch wrote:
>> The branch is here (and should be green most of the time):
> Doh ... I have to actually link it :)
> And I didn't mean branch I meant PR ;)
> https://github.com/dlang/dmd/pull/11146
This test now works with the GREEN branch
auto getUDAs(alias T)
{
return __traits(getAttributes, T);
pragma(msg, typeof(return));
}
// we can't parse alias[];
alias alias_array = typeof(getUDAs(SerializeTag));
struct SerializeTag {}
struct SuperTag {string s;}
struct TypeWithTags
{
alias type;
alias_array tags;
}
TypeWithTags typeWithTags(alias T)
{
auto udas = __traits(getAttributes, T);
return TypeWithTags(T, udas);
}
@SuperTag("Smoking Super Style") @SerializeTag @SuperTag("Super!")
struct ThisIsAType { double y; }
alias x = ThisIsAType;
pragma(msg, "typeWithTags: ", typeWithTags(x));
//output: TypeWithTags((ThisIsAType), [SuperTag("Smoking Super
Style"), (SerializeTag), SuperTag("Super!")])
More information about the Digitalmars-d
mailing list