Add assertion error message.

This commit is contained in:
Sönke Ludwig 2016-11-21 20:20:14 +01:00
parent 58a1cc274f
commit 537f17f71a

View file

@ -603,7 +603,8 @@ unittest { // issue #1
*/
ref inout(T) get(T, U)(ref inout(TaggedAlgebraic!U) ta)
{
assert(hasType!(T, U)(ta));
import std.format : format;
assert(hasType!(T, U)(ta), () { scope (failure) assert(false); return format("Trying to get %s but have %s.", T.stringof, ta.kind); } ());
return ta.trustedGet!T;
}