mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 15:40:36 +03:00
Fix Issue 10317 - Remove text(range) check and avoid recursive instantiation bug.
This commit is contained in:
parent
e9d5202062
commit
8f5f220194
1 changed files with 13 additions and 11 deletions
|
@ -8127,17 +8127,12 @@ sort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable,
|
||||||
quickSortImpl!(lessFun)(r);
|
quickSortImpl!(lessFun)(r);
|
||||||
else //use Tim Sort for semistable & stable
|
else //use Tim Sort for semistable & stable
|
||||||
TimSortImpl!(lessFun, Range).sort(r, null);
|
TimSortImpl!(lessFun, Range).sort(r, null);
|
||||||
static if (is(typeof(text(r))))
|
|
||||||
{
|
enum maxLen = 8;
|
||||||
enum maxLen = 8;
|
assert(isSorted!lessFun(r), text("Failed to sort range of type ",
|
||||||
assert(isSorted!lessFun(r), text("Failed to sort range of type ",
|
Range.stringof, ". Actual result is: ",
|
||||||
Range.stringof, ". Actual result is: ",
|
r[0 .. r.length > maxLen ? maxLen : r.length ],
|
||||||
r[0 .. r.length > maxLen ? maxLen : r.length ],
|
r.length > maxLen ? "..." : ""));
|
||||||
r.length > maxLen ? "..." : ""));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
assert(isSorted!lessFun(r), text("Unable to sort range of type ",
|
|
||||||
Range.stringof, ": <unable to print elements>"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -8190,6 +8185,13 @@ unittest
|
||||||
auto b = rndstuff!(string)();
|
auto b = rndstuff!(string)();
|
||||||
sort!("toLower(a) < toLower(b)")(b);
|
sort!("toLower(a) < toLower(b)")(b);
|
||||||
assert(isSorted!("toUpper(a) < toUpper(b)")(b));
|
assert(isSorted!("toUpper(a) < toUpper(b)")(b));
|
||||||
|
|
||||||
|
{
|
||||||
|
// Issue 10317
|
||||||
|
enum E_10317 { a, b }
|
||||||
|
auto a_10317 = new E_10317[10];
|
||||||
|
sort(a_10317);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private template validPredicates(E, less...) {
|
private template validPredicates(E, less...) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue