Skip to content

Commit

Permalink
Fix Issue 17878 - Add __traits(isFuture, ...)
Browse files Browse the repository at this point in the history
  • Loading branch information
RazvanN7 committed Oct 19, 2017
1 parent 26d0bf7 commit 03b13c7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ddmd/id.d
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ immutable Msgtable[] msgtable =
{ "isTemplate" },
{ "isPOD" },
{ "isDeprecated" },
{ "isFuture" },
{ "isNested" },
{ "isFloating" },
{ "isIntegral" },
Expand Down
5 changes: 5 additions & 0 deletions src/ddmd/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ shared static this()
"isArithmetic",
"isAssociativeArray",
"isDeprecated",
"isFuture",
"isFinalClass",
"isPOD",
"isNested",
Expand Down Expand Up @@ -470,6 +471,10 @@ extern (C++) Expression semanticTraits(TraitsExp e, Scope* sc)
{
return isDsymX(t => t.isDeprecated());
}
if (e.ident == Id.isFuture)
{
return isDeclX(t => t.isFuture());
}
if (e.ident == Id.isStaticArray)
{
return isTypeX(t => t.toBasetype().ty == Tsarray);
Expand Down
19 changes: 19 additions & 0 deletions test/runnable/test17878.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@__future int foo()
{
return 0;
}

int bar()
{
return 1;
}

@__future int c;


void main()
{
static assert(__traits(isFuture, foo));
static assert(!__traits(isFuture, bar));
static assert(__traits(isFuture, c));
}

0 comments on commit 03b13c7

Please sign in to comment.