mirror of
https://github.com/dlang/phobos.git
synced 2025-04-26 13:10:35 +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());
|
||||
}
|
||||
|
||||
private enum failedGetMessage(Expected, Actual) =
|
||||
"Tried to get `" ~ Expected.stringof ~ "`" ~
|
||||
" but found `" ~ Actual.stringof ~ "`";
|
||||
private template failedGetMessage(Expected, Actual)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue