From 51d18322907b2808cc43d333f75c605cbf7978ba Mon Sep 17 00:00:00 2001 From: Geod24 Date: Sat, 15 Aug 2020 16:35:53 +0900 Subject: [PATCH] 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. --- source/taggedalgebraic/taggedalgebraic.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/taggedalgebraic/taggedalgebraic.d b/source/taggedalgebraic/taggedalgebraic.d index ad297ab..bd932a9 100644 --- a/source/taggedalgebraic/taggedalgebraic.d +++ b/source/taggedalgebraic/taggedalgebraic.d @@ -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); }