Change hasType parameter from in to const scope

The two overloads (`in` and `in ref`) will conflict in the future.
To allow for `-preview=in` to be tested with many projects,
this simple fix can be applied. Later one, the overloads should
be merged into a single, `in` overload.
This commit is contained in:
Geod24 2020-08-15 16:35:53 +09:00
parent 49ab092d02
commit 51d1832290

View file

@ -627,7 +627,7 @@ unittest
/** Tests if the algebraic type stores a value of a certain data type.
*/
bool hasType(T, U)(in ref TaggedAlgebraic!U ta)
bool hasType(T, U)(const scope ref TaggedAlgebraic!U ta)
{
alias Fields = Filter!(fieldMatchesType!(U, T), ta.m_union.fieldNames);
static assert(Fields.length > 0, "Type "~T.stringof~" cannot be stored in a "~(TaggedAlgebraic!U).stringof~".");
@ -641,7 +641,7 @@ bool hasType(T, U)(in ref TaggedAlgebraic!U ta)
assert(false); // never reached
}
/// ditto
bool hasType(T, U)(in TaggedAlgebraic!U ta)
bool hasType(T, U)(const scope TaggedAlgebraic!U ta)
{
return hasType!(T, U)(ta);
}