mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 07:30:33 +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,18 +8127,13 @@ sort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable,
|
|||
quickSortImpl!(lessFun)(r);
|
||||
else //use Tim Sort for semistable & stable
|
||||
TimSortImpl!(lessFun, Range).sort(r, null);
|
||||
static if (is(typeof(text(r))))
|
||||
{
|
||||
|
||||
enum maxLen = 8;
|
||||
assert(isSorted!lessFun(r), text("Failed to sort range of type ",
|
||||
Range.stringof, ". Actual result is: ",
|
||||
r[0 .. r.length > maxLen ? maxLen : r.length ],
|
||||
r.length > maxLen ? "..." : ""));
|
||||
}
|
||||
else
|
||||
assert(isSorted!lessFun(r), text("Unable to sort range of type ",
|
||||
Range.stringof, ": <unable to print elements>"));
|
||||
}
|
||||
else
|
||||
{
|
||||
static assert(false, "Invalid predicate passed to sort: "~less);
|
||||
|
@ -8190,6 +8185,13 @@ unittest
|
|||
auto b = rndstuff!(string)();
|
||||
sort!("toLower(a) < toLower(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...) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue