mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 21:51:40 +03:00
sumtype: prevent ambiguity in failedGetMessage
This commit is contained in:
parent
03f7dbab9d
commit
1d3177ff2a
1 changed files with 17 additions and 3 deletions
|
@ -2987,9 +2987,23 @@ version (D_Exceptions)
|
||||||
assert(ctResult == ElaborateCopy());
|
assert(ctResult == ElaborateCopy());
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum failedGetMessage(Expected, Actual) =
|
private template failedGetMessage(Expected, Actual)
|
||||||
"Tried to get `" ~ Expected.stringof ~ "`" ~
|
{
|
||||||
" but found `" ~ Actual.stringof ~ "`";
|
static if (Expected.stringof == Actual.stringof)
|
||||||
|
{
|
||||||
|
enum expectedStr = __traits(fullyQualifiedName, Expected);
|
||||||
|
enum actualStr = __traits(fullyQualifiedName, Actual);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
enum expectedStr = Expected.stringof;
|
||||||
|
enum actualStr = Actual.stringof;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum failedGetMessage =
|
||||||
|
"Tried to get `" ~ expectedStr ~ "`" ~
|
||||||
|
" but found `" ~ actualStr ~ "`";
|
||||||
|
}
|
||||||
|
|
||||||
private template getLvalue(Flag!"try_" try_, T)
|
private template getLvalue(Flag!"try_" try_, T)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue