Fix issue 21663 - std.concurrency.receiveOnly doesn't work with tuples

This commit is contained in:
Paul Backus 2021-02-25 12:42:22 -05:00 committed by The Dlang Bot
parent eb20ee3d56
commit 6e6e024fa3

View file

@ -796,6 +796,7 @@ in
do do
{ {
import std.format : format; import std.format : format;
import std.meta : allSatisfy;
import std.typecons : Tuple; import std.typecons : Tuple;
Tuple!(T) ret; Tuple!(T) ret;
@ -803,7 +804,7 @@ do
thisInfo.ident.mbox.get((T val) { thisInfo.ident.mbox.get((T val) {
static if (T.length) static if (T.length)
{ {
static if (isAssignable!T) static if (allSatisfy!(isAssignable, T))
{ {
ret.field = val; ret.field = val;
} }
@ -888,6 +889,12 @@ do
assert(result == "Unexpected message type: expected 'string', got 'int'"); assert(result == "Unexpected message type: expected 'string', got 'int'");
} }
// https://issues.dlang.org/show_bug.cgi?id=21663
@safe unittest
{
alias test = receiveOnly!(string, bool, bool);
}
/** /**
* Receives a message from another thread and gives up if no match * Receives a message from another thread and gives up if no match
* arrives within a specified duration. * arrives within a specified duration.