enum can also be used in is() expressions

fixes #174
This commit is contained in:
Andreas Zwinkau 2015-08-20 20:28:49 +02:00
parent e4297a63c3
commit eea508f930
4 changed files with 24 additions and 6 deletions

View file

@ -794,12 +794,16 @@ private:
write(" ");
break;
case tok!"enum":
if (peekBackIs(tok!"identifier"))
write(" ");
indents.push(tok!"enum");
writeToken();
if (!currentIs(tok!":"))
write(" ");
if (peekIs(tok!")") || peekIs(tok!"==")) {
writeToken();
} else {
if (peekBackIs(tok!"identifier"))
write(" ");
indents.push(tok!"enum");
writeToken();
if (!currentIs(tok!":"))
write(" ");
}
break;
default:
if (peekBackIs(tok!"identifier"))

View file

@ -0,0 +1,5 @@
void merge()
{
static if (is(T == enum))
*thisN = x;
}

5
tests/issue0174.d Normal file
View file

@ -0,0 +1,5 @@
void merge()
{
static if (is(T == enum))
*thisN = x;
}

View file

@ -0,0 +1,4 @@
void merge() {
static if (is(T == enum))
*thisN = x;
}