Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1094 from AndrejMitrovic/Fix9373

Issue 9373 - Add deprecation messages to Phobos.
  • Loading branch information...
commit 2ca9e55a9105ed1237d0b4777a88f8a3f533cba2 2 parents c89b21e + aaa6854
@jmdavis jmdavis authored
View
27 std/algorithm.d
@@ -4606,7 +4606,8 @@ unittest
* assert(std.algorithm.countUntil("日本語", '本') == 1);
* --------
*/
-deprecated ptrdiff_t indexOf(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle)
+deprecated("Please use std.algorithm.countUntil instead.")
+ptrdiff_t indexOf(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle)
if (is(typeof(startsWith!pred(haystack, needle))))
{
return countUntil!pred(haystack, needle);
@@ -6160,7 +6161,7 @@ assert(minCount!("a > b")(a) == tuple(4, 2));
*/
Tuple!(ElementType!Range, size_t)
minCount(alias pred = "a < b", Range)(Range range)
- if (isInputRange!Range && !isInfinite!Range &&
+ if (isInputRange!Range && !isInfinite!Range &&
is(typeof(binaryFun!pred(range.front, range.front))))
{
enforce(!range.empty, "Can't count elements from an empty range");
@@ -6222,7 +6223,7 @@ assert(minPos!("a > b")(a) == [ 4, 1, 2, 4, 1, 1, 2 ]);
----
*/
Range minPos(alias pred = "a < b", Range)(Range range)
- if (isForwardRange!Range && !isInfinite!Range &&
+ if (isForwardRange!Range && !isInfinite!Range &&
is(typeof(binaryFun!pred(range.front, range.front))))
{
if (range.empty) return range;
@@ -9781,30 +9782,26 @@ unittest
}
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.canFind.
-deprecated bool canFindSorted(alias pred = "a < b", Range, V)(Range range, V value) {
- pragma(msg, "std.algorithm.canFindSorted has been deprecated. " ~
- "Please use std.range.SortedRange.canFind instead.");
+deprecated("Please use std.range.SortedRange.canFind instead.")
+bool canFindSorted(alias pred = "a < b", Range, V)(Range range, V value) {
return assumeSorted!pred(range).canFind!V(value);
}
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.lowerBound.
-deprecated Range lowerBound(alias pred = "a < b", Range, V)(Range range, V value) {
- pragma(msg, "std.algorithm.lowerBound has been deprecated. " ~
- "Please use std.range.SortedRange.lowerBound instead.");
+deprecated("Please use std.range.SortedRange.lowerBound instead.")
+Range lowerBound(alias pred = "a < b", Range, V)(Range range, V value) {
return assumeSorted!pred(range).lowerBound!V(value).release;
}
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.upperBound.
-deprecated Range upperBound(alias pred = "a < b", Range, V)(Range range, V value) {
- pragma(msg, "std.algorithm.upperBound has been deprecated. " ~
- "Please use std.range.SortedRange.upperBound instead.");
+deprecated("Please use std.range.SortedRange.upperBound instead.")
+Range upperBound(alias pred = "a < b", Range, V)(Range range, V value) {
return assumeSorted!pred(range).upperBound!V(value).release;
}
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.equalRange.
-deprecated Range equalRange(alias pred = "a < b", Range, V)(Range range, V value) {
- pragma(msg, "std.algorithm.equalRange has been deprecated. " ~
- "Please use std.range.SortedRange.equalRange instead.");
+deprecated("Please use std.range.SortedRange.equalRange instead.")
+Range equalRange(alias pred = "a < b", Range, V)(Range range, V value) {
return assumeSorted!pred(range).equalRange!V(value).release;
}
View
3  std/concurrency.d
@@ -744,7 +744,8 @@ unittest
}
//Explicitly undocumented. Do not use. To be removed in March 2013.
-deprecated bool receiveTimeout(T...)( long ms, T ops )
+deprecated("Please use the overload of receiveTimeout which takes a Duration.")
+bool receiveTimeout(T...)( long ms, T ops )
{
return receiveTimeout( dur!"msecs"( ms ), ops );
}
View
37 std/conv.d
@@ -1131,13 +1131,11 @@ unittest
Conversions to string with optional configures.
*/
-deprecated T toImpl(T, S)(S s, in T leftBracket, in T separator = ", ", in T rightBracket = "]")
+deprecated("Please use std.format.formattedWrite instead.")
+T toImpl(T, S)(S s, in T leftBracket, in T separator = ", ", in T rightBracket = "]")
if (!isSomeChar!(ElementType!S) && (isInputRange!S || isInputRange!(Unqual!S)) &&
isExactSomeString!T)
{
- pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
- "std.format.formattedWrite"));
-
static if (!isInputRange!S)
{
alias toImpl!(T, Unqual!S) ti;
@@ -1168,24 +1166,20 @@ deprecated T toImpl(T, S)(S s, in T leftBracket, in T separator = ", ", in T rig
}
/// ditto
-deprecated T toImpl(T, S)(ref S s, in T leftBracket, in T separator = " ", in T rightBracket = "]")
+deprecated("Please use std.format.formattedWrite instead.")
+T toImpl(T, S)(ref S s, in T leftBracket, in T separator = " ", in T rightBracket = "]")
if ((is(S == void[]) || is(S == const(void)[]) || is(S == immutable(void)[])) &&
isExactSomeString!T)
{
- pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
- "std.format.formattedWrite"));
-
return toImpl(s);
}
/// ditto
-deprecated T toImpl(T, S)(S s, in T leftBracket, in T keyval = ":", in T separator = ", ", in T rightBracket = "]")
+deprecated("Please use std.format.formattedWrite instead.")
+T toImpl(T, S)(S s, in T leftBracket, in T keyval = ":", in T separator = ", ", in T rightBracket = "]")
if (isAssociativeArray!S && !is(S == enum) &&
isExactSomeString!T)
{
- pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
- "std.format.formattedWrite"));
-
alias Unqual!(ElementEncodingType!T) Char;
auto result = appender!(Char[])();
// hash-to-string conversion
@@ -1205,26 +1199,22 @@ deprecated T toImpl(T, S)(S s, in T leftBracket, in T keyval = ":", in T separat
}
/// ditto
-deprecated T toImpl(T, S)(S s, in T nullstr)
+deprecated("Please use std.format.formattedWrite instead.")
+T toImpl(T, S)(S s, in T nullstr)
if (is(S : Object) &&
isExactSomeString!T)
{
- pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
- "std.format.formattedWrite"));
-
if (!s)
return nullstr;
return to!T(s.toString());
}
/// ditto
-deprecated T toImpl(T, S)(S s, in T left, in T separator = ", ", in T right = ")")
+deprecated("Please use std.format.formattedWrite instead.")
+T toImpl(T, S)(S s, in T left, in T separator = ", ", in T right = ")")
if (is(S == struct) && !is(typeof(&S.init.toString)) && !isInputRange!S &&
isExactSomeString!T)
{
- pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
- "std.format.formattedWrite"));
-
Tuple!(FieldTypeTuple!S) * t = void;
static if ((*t).sizeof == S.sizeof)
{
@@ -3800,10 +3790,3 @@ unittest
toTextRange(-1, result);
assert(result.data == "-1");
}
-
-template hardDeprec(string vers, string date, string oldFunc, string newFunc)
-{
- enum hardDeprec = Format!("Notice: As of Phobos %s, %s has been deprecated. " ~
- "It will be removed in %s. Please use %s instead.",
- vers, oldFunc, date, newFunc);
-}
View
3  std/exception.d
@@ -562,7 +562,8 @@ template enforceEx(E)
If $(D !!value) is $(D true), $(D value) is returned. Otherwise,
$(D new E(msg)) is thrown.
+/
-deprecated template enforceEx(E)
+deprecated("Please use the version of enforceEx which takes an exception that constructs with new E(msg, file, line).")
+template enforceEx(E)
if (is(typeof(new E(""))) && !is(typeof(new E("", __FILE__, __LINE__))) && !is(typeof(new E(__FILE__, __LINE__))))
{
T enforceEx(T)(T value, lazy string msg = "")
View
12 std/file.d
@@ -2028,7 +2028,8 @@ unittest
* }
* ----
*/
-deprecated alias listDir listdir;
+deprecated("Please use dirEntries instead.")
+alias listDir listdir;
/***************************************************
@@ -3027,7 +3028,8 @@ void main(string[] args)
}
--------------------
+/
-deprecated string[] listDir(C)(in C[] pathname)
+deprecated("Please use dirEntries instead.")
+string[] listDir(C)(in C[] pathname)
{
auto result = appender!(string[])();
@@ -3097,7 +3099,8 @@ void main(string[] args)
}
--------------------
+/
-deprecated string[] listDir(C, U)(in C[] pathname, U filter, bool followSymlink = true)
+deprecated("Please use dirEntries instead.")
+string[] listDir(C, U)(in C[] pathname, U filter, bool followSymlink = true)
if(is(C : char) && !is(U: bool delegate(string filename)))
{
import std.regexp;
@@ -3169,7 +3172,8 @@ deprecated string[] listDir(C, U)(in C[] pathname, U filter, bool followSymlink
* }
* ----
*/
-deprecated void listDir(C, U)(in C[] pathname, U callback)
+deprecated("Please use dirEntries instead.")
+void listDir(C, U)(in C[] pathname, U callback)
if(is(C : char) && is(U: bool delegate(string filename)))
{
_listDir(pathname, callback);
View
3  std/format.d
@@ -66,7 +66,8 @@ class FormatException : Exception
$(RED Deprecated. It will be removed In January 2013.
Please use $(D FormatException) instead.)
+/
-deprecated alias FormatException FormatError;
+deprecated("Please use FormatException instead.")
+alias FormatException FormatError;
/**********************************************************************
Interprets variadic argument list $(D args), formats them according
View
3  std/syserror.d
@@ -12,7 +12,8 @@ module std.syserror;
// Deprecated - instead use std.windows.syserror.sysErrorString()
-deprecated class SysError
+deprecated("Please use std.windows.syserror.sysErrorString instead")
+class SysError
{
private import std.c.stdio;
private import std.c.string;
View
9 std/windows/registry.d
@@ -1265,12 +1265,14 @@ public:
return value;
}
- deprecated uint value_DWORD_LITTLEENDIAN()
+ deprecated("Please use value_DWORD instead.")
+ uint value_DWORD_LITTLEENDIAN()
{
return value_DWORD;
}
- deprecated uint value_DWORD_BIGENDIAN()
+ deprecated("Please use value_DWORD instead.")
+ uint value_DWORD_BIGENDIAN()
{
return value_DWORD;
}
@@ -1293,7 +1295,8 @@ public:
return value;
}
- deprecated ulong value_QWORD_LITTLEENDIAN()
+ deprecated("Please use value_QWORD instead.")
+ ulong value_QWORD_LITTLEENDIAN()
{
return value_QWORD;
}
Please sign in to comment.
Something went wrong with that request. Please try again.