dmd/compiler/test/fail_compilation/diag13884.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

34 lines
622 B
D

/*
TEST_OUTPUT:
---
fail_compilation/diag13884.d(14): Error: functions cannot return a sequence (use `std.typecons.Tuple`)
fail_compilation/diag13884.d(21): instantiated from here: `MapResult!((t) => t.tupleof, Foo[])`
fail_compilation/diag13884.d(14): instantiated from here: `map!(Foo[])`
---
*/
struct Foo { int x; }
void main()
{
[Foo(1)].map!(t => t.tupleof);
}
template map(fun...)
{
auto map(Range)(Range r)
{
return MapResult!(fun, Range)(r);
}
}
struct MapResult(alias fun, R)
{
R _input;
@property auto ref front()
{
return fun(_input[0]);
}
}