dmd/compiler/test/compilable/test19728.d
Nick Treleaven bb638373d6
Fix Issue 15436 - Compiler still refers to AliasSeq-s as "tuple"-s (#15363)
* Fix Issue 15436 - Compiler still refers to AliasSeq-s as "tuple"-s

Replace "tuple type" with "type sequence".
Replace "tuple" with "sequence".
Pretty print `AliasSeq!(args)`, not `tuple(args)`.
Leave json as "tuple" for now.
Also mention std.typecons.Tuple when trying to return a sequence.

Note: This does not rename any internal compiler symbols.

* Update runnable tests

* Update stringof tests

* Update remaining tests

* retrigger tests
2023-06-30 11:02:00 +03:00

52 lines
1.4 KiB
D

/*
TEST_OUTPUT:
---
AliasSeq!((A), (B))
AliasSeq!((A), (B), 0)
AliasSeq!((A), (B), (A))
AliasSeq!((A), (B), (A), (B))
AliasSeq!((A), (B), (A), (B))
AliasSeq!((A), (B), (A), (B), (A), (B), (A), (B))
AliasSeq!((Attr))
---
*/
// Issue 19728
enum A; enum B; enum Dummy = 0;
alias Seq(T...) = T;
@Seq!(A,B) struct Foo1 {}
@Seq!(A,B, Dummy) struct Foo2 {}
@Seq!(A,B,A) struct Foo3 {}
@Seq!(Seq!(A,B,A,B)) struct Foo4 {}
@Seq!(A,Seq!(B,A),B) struct Foo5 {}
@Seq!(A,Seq!(B,A),B) @Seq!(A,B,A,B) struct Foo6 {}
pragma(msg, __traits(getAttributes, Foo1));
pragma(msg, __traits(getAttributes, Foo2));
pragma(msg, __traits(getAttributes, Foo3));
pragma(msg, __traits(getAttributes, Foo4));
pragma(msg, __traits(getAttributes, Foo5));
pragma(msg, __traits(getAttributes, Foo6));
struct S(T...) {}
static assert(is( S!(A,B) == S!(__traits(getAttributes, Foo1))));
static assert(is( S!(A,B,Dummy) == S!(__traits(getAttributes, Foo2))));
static assert(is( S!(A,B,A) == S!(__traits(getAttributes, Foo3))));
static assert(is( S!(A,B,A,B) == S!(__traits(getAttributes, Foo4))));
static assert(is( S!(A,B,A,B) == S!(__traits(getAttributes, Foo5))));
static assert(is(S!(A,B,A,B,A,B,A,B) == S!(__traits(getAttributes, Foo6))));
// Issue 20093
mixin template MakeProperty(Attributes...) {
@(Attributes) void bug() {}
}
struct Attr { }
struct Test {
mixin MakeProperty!(Attr);
}
pragma(msg, __traits(getAttributes, Test.bug));