Commit graph

147 commits

Author SHA1 Message Date
Vladiwostok
231ae8b68a
Fix D-Scanner linting issues (#9070)
* Fix UndocumentedDeclarationCheck linting issue

* Fix IfConstraintsIndentCheck linting issue

* Address feedback

* Fix publictests CI

* Fix old (libdparse) D-Scanner linting warn
2024-10-27 01:21:56 -07:00
Robert burner Schadek
d8c627e037 Better std.algorithm.comparison.clamp error messages 2023-03-15 16:53:20 +01:00
RazvanN7
7990916723 Fix Issue 23268 - clamp no longer accepts shorts 2022-08-31 11:10:51 +02:00
Tomáš Chaloupka
9ac9d359ac Fix 23132 - Avoid ranges copy when compared for equality 2022-06-21 15:09:48 +00:00
RazvanN7
6f5b2d6b60 Document how the returned value of clamp is converted to the return type 2021-10-26 16:07:27 +03:00
Andrei Alexandrescu
fb55df97e4 Add unittests 2021-10-25 17:28:19 -06:00
Andrei Alexandrescu
0efda76c67 Variadic isSameLength 2021-10-25 17:19:50 -06:00
Andrei Alexandrescu
82868eaf9e Variadic mismatch 2021-10-23 08:47:08 +00:00
Andrei Alexandrescu
f91bfff148 Update std/algorithm/comparison.d
Co-authored-by: Razvan Nitu <razvan.nitu1305@gmail.com>
2021-10-19 10:42:27 -04:00
Andrei Alexandrescu
43cfc832b4 Fix bug 2021-10-19 10:42:27 -04:00
Andrei Alexandrescu
e98114183c Simpler code for length comparison 2021-10-19 10:42:27 -04:00
Andrei Alexandrescu
c21f0ea8eb Compare all available lengths prior to entering the loop 2021-10-19 10:42:27 -04:00
Andrei Alexandrescu
963274f1c1 RFC: alternative variadic implementation of equals 2021-10-19 10:42:27 -04:00
Andrei Alexandrescu
3041b3768b Fix Issue 22414 - clamp(a, b, c) should always return typeof(a) 2021-10-18 10:14:48 -04:00
MoonlightSentinel
3e70aac3ae
Fix 22384 - Treat noreturn handlers like void in castSwitch
The previous check assumed that non-`void` return implies a returned
value - which obviously does not apply for `noreturn`.
Further code then assumed that `void` handlers should throw an exception
and hence threw an error when it didn't throw.
2021-10-13 17:35:11 +02:00
Walter Bright
ef28dede87
specialize max/min for common case (#7499)
specialize max/min for common case

Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com>
Merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-07-09 13:20:43 +00:00
Nathan Sashihara
a5e0d8c17b Remove unnecessary threeWayCompareLength from cmp 2021-04-24 04:15:53 +02:00
berni44
b2019ebab0 Narrow imports of std.math in the rest of phobos. 2021-04-21 03:00:57 +02:00
Bernhard Seckinger
9cb7755041 Replace approxEqual with isClose 2021-01-28 10:39:50 +01:00
Andrei Alexandrescu
311f00f8ac
Merge pull request #7632 from andralex/minmax
Simplify min and max
2020-09-19 16:19:07 -04:00
Andrei Alexandrescu
620a5a042d Push useCodePoint all the way in 2020-09-18 10:43:27 -04:00
Andrei Alexandrescu
e048dbeb18 Review 2020-09-18 10:43:27 -04:00
Andrei Alexandrescu
369ed6edb6 No need for isEmptyRange 2020-09-18 10:42:03 -04:00
Andrei Alexandrescu
890cd7e8b7 A few more minor improvements to std.algorithm.comparison: pushed implementation constraint down, undocument superfluous flag name, allow comparison of lengths involving infinite ranges, simplify implementation of isSameLength 2020-09-18 10:42:03 -04:00
Andrei Alexandrescu
cae6379750 Fix Issue 21249 - clamp() is not stable and is not constrained 2020-09-16 01:20:51 +02:00
Andrei Alexandrescu
639bedbea8 Fix min 2020-09-13 17:25:20 -04:00
Andrei Alexandrescu
43c95c46d8 Improve type computation - a type that defines max could mess things up 2020-09-13 16:43:42 -04:00
Andrei Alexandrescu
423f633fd7 Simplify min and max 2020-09-13 10:47:18 -04:00
Andrei Alexandrescu
6194b17295 Fix Issue 21191 - min should be stable: when in doubt, return the first argument 2020-08-28 08:19:40 +02:00
Steven Schveighoffer
17ae8fc9be Make it so std.utf can be tested with no autodecoding. 2020-08-17 06:53:34 +02:00
Nathan Sashihara
453faadf5b Replace is(Unqual!T == Unqual!U) with is(immutable T == immutable U) for speed & memory usage 2020-08-03 15:07:32 +02:00
Geod24
04f3979317 Replace 'Issue XXX' with Bugzilla links
Make the links clickable, as was done in the DMD repository.
Also avoids any ambiguity w.r.t. where the issue is stored.
2020-04-13 16:28:09 +09:00
Atila Neves
69ae443df4 Replace .staticArray with explicit declarations 2020-03-19 16:18:53 +01:00
Atila Neves
825b72dc88 Restore changes to among unittest that fails on Windows 2020-03-19 15:03:20 +01:00
Atila Neves
9a6f9543cf Address style violations 2020-03-18 18:02:01 +01:00
Atila Neves
bdacde79c3 Add @nogc to all relevant unittests in comparison.d 2020-03-18 18:02:01 +01:00
Bernhard Seckinger
0320d88c3a Fix Issue 10448 - min and max are not NaN aware 2019-10-21 11:40:09 +02:00
David Gileadi
775bcdee51 Turn on -preview=markdown 2019-07-04 10:28:30 -07:00
Robert Schadek
ef71418e73 Adds assert messages 2019-06-25 09:16:27 +01:00
Sebastian Wilzbach
12c5e1ee91 Use selective top-level module imports in std.algorithm 2019-05-23 10:21:19 +02:00
Nathan Sashihara
7bfb207376 Fix Issue 19412 - std.algorithm.cmp with default ordering can use memcmp for all size 1 unsigned types
... instead of just char.
2019-03-08 19:52:21 -05:00
Vasniktel
8356511ffb Fixed comparison bug (#6888)
Fixed comparison bug
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-03-08 12:50:24 +01:00
Manu Evans
3ac8804df1 min/max shouldn't pull std.format 2018-12-10 01:03:28 -08:00
Sebastian Wilzbach
57d12560c5 Start to add @betterC to std.algorithm.comparison 2018-08-21 17:19:21 +02:00
Sebastian Wilzbach
c324714fde Remove a few cases of underscore escaping 2018-06-04 13:05:01 +02:00
Sebastian Wilzbach
d9830b739e Fix DScanner warnings 2018-02-10 22:46:32 +01:00
Sebastian Wilzbach
7fb3d4249f Remove references to STL 2018-01-30 16:08:20 +01:00
Nathan Sashihara
7f59e5ad52 Fix Issue 18280 - std.algorithm.comparison.cmp for non-strings should call opCmp only once per item pair
split cmp into two overloads per @andralex

https://github.com/dlang/phobos/pull/6056#pullrequestreview-90687092

Minor adjustments, again

cmp should return auto and let opCmp drive

https://github.com/dlang/phobos/pull/6056#issuecomment-359665184

Fix Issue 18285 - std.algorithm.comparison.cmp for strings with custom predicate compares lengths wrong

Test std.algorithm.comparison.cmp when opCmp returns float

Promotions should not use cast

Optimize cmp's endgame

There are some redundant tests when the end of the ranges is reached. Eliminated that, and improved threeWayByPred.

Fix Issue 18286 - std.algorithm.comparison.cmp for string with custom predicate fails if distinct chars can compare equal

Fix Issue 18288 - std.algorithm.comparison.cmp for wide strings should be @safe

re-apply remove cast in promotions
2018-01-23 19:54:58 -05:00
Sebastian Wilzbach
fc0c29f3a2 Markdownify std.algorithm
Done with: https://github.com/wilzbach/dscanner-fix/blob/master/d_code_markdown.d
2017-12-29 01:17:40 +01:00
Sebastian Wilzbach
2591b61b4f Start removing std.{json,zip,zlib,algorithm.mutation}
from the assert_without_msg blacklist
2017-12-01 09:28:05 +01:00