mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 14:10:30 +03:00
Fixes Issue 9373 - Add deprecation messages to Phobos.
This commit is contained in:
parent
c89b21e38f
commit
aaa6854eb7
8 changed files with 44 additions and 53 deletions
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
37
std/conv.d
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);
|
||||
}
|
||||
|
|
|
@ -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 = "")
|
||||
|
|
12
std/file.d
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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue