Skip to content

Commit

Permalink
fix Issue 13839 - Use new style for alias declarations in di files
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Dec 9, 2014
1 parent 16fcb2d commit 10bfa8d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 33 deletions.
14 changes: 11 additions & 3 deletions src/hdrgen.c
Expand Up @@ -1655,12 +1655,20 @@ class PrettyPrintVisitor : public Visitor
buf->writestring("alias ");
if (d->aliassym)
{
d->aliassym->accept(this);
buf->writeByte(' ');
buf->writestring(d->ident->toChars());
buf->writestring(" = ");
d->aliassym->accept(this);
}
else
else if (d->type->ty == Tfunction)
{
typeToBuffer(d->type, d->ident);
}
else
{
buf->writestring(d->ident->toChars());
buf->writestring(" = ");
typeToBuffer(d->type, NULL);
}
buf->writeByte(';');
buf->writenl();
}
Expand Down
2 changes: 2 additions & 0 deletions test/compilable/extra-files/header1.d
Expand Up @@ -233,6 +233,8 @@ class Test
alias A!(ushort) getHUShort;
alias A!(real) getHReal;

alias void F();

pure nothrow @safe @nogc unittest {}
pure nothrow @safe @nogc invariant {}

Expand Down
29 changes: 15 additions & 14 deletions test/compilable/extra-files/header1.di
Expand Up @@ -4,7 +4,7 @@ import std.stdio;
pragma (lib, "test");
pragma (msg, "Hello World");
static assert(true, "message");
alias double mydbl;
alias mydbl = double;
int testmain();
struct S
{
Expand Down Expand Up @@ -154,7 +154,7 @@ class Foo3
this(int a, ...);
this(int* a);
}
alias int myint;
alias myint = int;
static notquit = 1;
class Test
{
Expand Down Expand Up @@ -192,17 +192,18 @@ class Test
template A(T)
{
}
alias A!uint getHUint;
alias A!int getHInt;
alias A!float getHFloat;
alias A!ulong getHUlong;
alias A!long getHLong;
alias A!double getHDouble;
alias A!byte getHByte;
alias A!ubyte getHUbyte;
alias A!short getHShort;
alias A!ushort getHUShort;
alias A!real getHReal;
alias getHUint = A!uint;
alias getHInt = A!int;
alias getHFloat = A!float;
alias getHUlong = A!ulong;
alias getHLong = A!long;
alias getHDouble = A!double;
alias getHByte = A!byte;
alias getHUbyte = A!ubyte;
alias getHShort = A!short;
alias getHUShort = A!ushort;
alias getHReal = A!real;
alias void F();
nothrow pure @nogc @safe new(size_t sz);
nothrow pure @nogc @safe delete(void* p);
}
Expand Down Expand Up @@ -248,7 +249,7 @@ class Baz4
{
mixin Foo4!() foo;
mixin Foo4x!(int, "str") foox;
alias foo.bar baz;
alias baz = foo.bar;
}
int test(T)(T t)
{
Expand Down
29 changes: 15 additions & 14 deletions test/compilable/extra-files/header1i.di
Expand Up @@ -4,7 +4,7 @@ import std.stdio;
pragma (lib, "test");
pragma (msg, "Hello World");
static assert(true, "message");
alias double mydbl;
alias mydbl = double;
int testmain()
in
{
Expand Down Expand Up @@ -193,7 +193,7 @@ class Foo3
{
}
}
alias int myint;
alias myint = int;
static notquit = 1;
class Test
{
Expand Down Expand Up @@ -293,17 +293,18 @@ class Test
template A(T)
{
}
alias A!uint getHUint;
alias A!int getHInt;
alias A!float getHFloat;
alias A!ulong getHUlong;
alias A!long getHLong;
alias A!double getHDouble;
alias A!byte getHByte;
alias A!ubyte getHUbyte;
alias A!short getHShort;
alias A!ushort getHUShort;
alias A!real getHReal;
alias getHUint = A!uint;
alias getHInt = A!int;
alias getHFloat = A!float;
alias getHUlong = A!ulong;
alias getHLong = A!long;
alias getHDouble = A!double;
alias getHByte = A!byte;
alias getHUbyte = A!ubyte;
alias getHShort = A!short;
alias getHUShort = A!ushort;
alias getHReal = A!real;
alias void F();
nothrow pure @nogc @safe new(size_t sz)
{
return null;
Expand Down Expand Up @@ -354,7 +355,7 @@ class Baz4
{
mixin Foo4!() foo;
mixin Foo4x!(int, "str") foox;
alias foo.bar baz;
alias baz = foo.bar;
}
int test(T)(T t)
{
Expand Down
2 changes: 1 addition & 1 deletion test/compilable/extra-files/header2.di
Expand Up @@ -57,7 +57,7 @@ interface I4(T) if ((int[1]).length == 1)
}
template MyClass4(T) if (is(typeof(T.subtype)))
{
alias T.subtype HelperSymbol;
alias HelperSymbol = T.subtype;
class MyClass4
{
}
Expand Down
2 changes: 1 addition & 1 deletion test/compilable/extra-files/header2i.di
Expand Up @@ -70,7 +70,7 @@ interface I4(T) if ((int[1]).length == 1)
}
template MyClass4(T) if (is(typeof(T.subtype)))
{
alias T.subtype HelperSymbol;
alias HelperSymbol = T.subtype;
class MyClass4
{
}
Expand Down

0 comments on commit 10bfa8d

Please sign in to comment.