Commit graph

20501 commits

Author SHA1 Message Date
Vladimir Panteleev
6caa5fa19a
std.container.rbtree: Add trisect (#10756)
Useful in case we need >= or <= (instead of > or < or = as provided by
lowerBound/upperBound/equalRange).

Same convention as SortedRange.trisect, except just return a static
array instead of a tuple (as the type is the same).
2025-04-20 07:29:02 +08:00
Akshat Sharma
0dbb785ae9
Improve error message for to!string when used on infinite ranges (#10744)
Partial Fix: #10559

Improve the error message to:
  static assert(0, "Cannot convert infinite range to string. Use `std.range.take` or `std.range.takeExactly` to make it finite.");

Also add a unittest to verify that compilation fails when an infinite range is passed for string conversion.

Co-authored-by: Paul Backus <snarwin@gmail.com>
2025-04-15 15:34:35 +08:00
Parmar Mahipalsinh
811f67e95c
fix: remove stray parenthesis in changelog README (#10745) 2025-04-08 23:08:28 +08:00
Artha
39663ea8fe
Fix #10742: withExtension should support ranges with mutable properties (#10737) 2025-04-07 04:25:01 +08:00
Nick Treleaven
393d8264bb
[std.algorithm.searching] Tweak countUntil docs (#10734)
For a single needle, it only requires an input range.
Split docs for unary `pred`.
Document `needle` parameter.
Explain pseudo-tuple returned, extend example.
2025-04-03 15:51:28 -07:00
gulugulubing
d2587823d0
fix std.encoding.sanitize usable in @safe.Fix #10545 (#10735) 2025-04-03 15:47:36 -07:00
Nick Treleaven
d9fd09d73a
[std.algorithm.iteration] Tweak splitter, splitWhen docs (#10733)
Update splitter cheat sheet for non-separator overloads.
Add constraint for splitWhen's `pred`.
`splitter!isTerminator` always returns a forward range.
2025-04-02 20:37:50 +08:00
Dennis
ff612b867c
Merge pull request #10732 from dlang/stable
Merge stable
2025-04-02 13:43:44 +02:00
David Isinta Nyakawa
82338661b3
Fix Issue 10523 - Enabled BigInt to work in CTFE (#10725)
made biguint core ctfe valid by removing free keyword at compile time
2025-04-02 13:28:08 +08:00
Nick Treleaven
a86eaca27b
[std.algorithm] Separate splitter overload with isTerminator parameter (#10729)
This makes it easier to follow the docs.
Move 2 documented unittests under isTerminator overload.
Tweak isWhite example to use `\t`, not just a single space.
2025-04-02 07:53:23 +08:00
Dennis Korpel
60034b56e2 purge changelog 2025-03-31 13:33:59 +02:00
Vladimir Panteleev
94903c884a
std.net.curl: Fix fast-path check when encoding is "utf-8" (lower-case) (#10721)
For HTTP, the response body encoding is specified in the
"Content-Type" header, e.g.: "Content-Type: application/json;
charset=utf-8".

MDN says:

> - `charset`: Indicates the character encoding standard used.
>   The value is **case insensitive but lowercase is preferred**.

However, `_decodeContent` was comparing the encoding with the exact
string "UTF-8", which causes most HTTP requests to go through the slow
path.

Fix this by using `icmp`, like elsewhere in the module for
case-insensitive string comparisons.
2025-03-29 18:59:08 +08:00
Aditya Chincholkar
1de571c710
Adding a lazy version of std.algorithm.iteration.cache #10687 Open Feature (#10709)
* added Lazycache feature

* Added Lazycache funtion

* changes as per review

* Update std/algorithm/iteration.d

Co-authored-by: Richard (Rikki) Andrew Cattermole <pbdadmin@gmail.com>

* removing unrelated change

* added lazychache in cheatsheet

* removed error

* add_lazycache_function.dd

* changes in changelog

* lines changes in changelog

* removing whitspace

---------

Co-authored-by: Richard (Rikki) Andrew Cattermole <pbdadmin@gmail.com>
2025-03-28 15:23:30 -07:00
Paul Backus
b7395ea7f5
std.conv: add writeText, writeWText, writeDText (#10652)
* std.conv: factor out writeTextImpl from textImpl

* std.conv: add writeText, writeWText, writeDText

These are variants of text, wtext, and dtext that write their output to
an output range instead of returning a string.

Fixes #10550

* Add changelog entry for writeText
2025-03-28 15:23:12 -07:00
Paul Backus
4ec4e54bcd
Update DSCANNER_HASH for interpolated strings (#10720) 2025-03-28 12:49:30 -07:00
Richard (Rikki) Andrew Cattermole
205256abb1
Fix #10699 - std.format with position with omitted second number does not work (#10716) 2025-03-28 01:49:06 -07:00
Aditya Chincholkar
dfc3d021c6
Fix #10513 - powmod is slow for ulong (#10688)
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
2025-03-27 17:54:57 +08:00
Elias Batek
89f5914683
Revert "Fix #9584 - Using dirEntries and chdir() can have unwanted results (#10666)" (#10718)
This essentially reverts commit 274109b3de.
2025-03-27 16:21:21 +08:00
Iain Buclaw
530660bd9b
std.allocator: Comment out broken class instance size test (#10717)
This can be reverted after the fix for dlang issue 21065 is merged

Refs: dlang/dmd#21065
2025-03-27 07:31:01 +08:00
Inkrementator
0edef23caf
Variant segfault (#10697)
* Reference correct issue for test

* Variant: Fix Segfault on adding in wrapped AA
2025-03-26 07:14:47 +08:00
Richard (Rikki) Andrew Cattermole
c64232d813
Fix #10713 - std.format string positions affect all further format specifiers (#10714) 2025-03-25 16:10:34 +08:00
Elias Batek
b57f75d44e
Tune FreeBSD timeouts on GitHub Actions (#10708)
Currently, our FreeBSD CI tests either complete within about 11 minutes
or timeout after 60 mins – ~50 of them spent idling erroneously.

The new values are calculated as follows:
Timeout taken of DMD's "main" workflow + 5 extra minutes

- <2036516c17/.github/workflows/main.yml (L194)>
- <2036516c17/.github/workflows/main.yml (L201)>
2025-03-24 10:33:32 +08:00
Inkrementator
91af96cddb
Change documentation for reduce (#10707)
* reduce: Document Acc, Elem order in most visible place

* Reduce doesn't enforce predicates

* Reduce: Document behaviour on range with 1 elem

* Doc: Remove references to implemententation detail

Accumulator is the commonly used term for this concept.
2025-03-24 05:39:45 +08:00
Elias Batek
12f99e5fff
Remove empty line between doc comment and unittest (#10705) 2025-03-23 16:23:10 +08:00
Martin Kinkelin
b41bcd93df
std.experimental.allocator.building_blocks.allocator_list: Fix unittests on macOS arm64 (#10704)
Otherwise hitting a consistently failing assertion for LDC CI.
2025-03-23 07:51:23 +08:00
Paul Backus
3dc8091758
Merge pull request #10703 from VPanteleev-S7/json-tohash
std.json: Add JSONValue.toHash
2025-03-22 15:42:05 -04:00
Vladimir Panteleev
6beff688d2 std.json: Add JSONValue.toHash
Allows using JSON values in sets and map keys.
2025-03-22 17:38:24 +00:00
Paul Backus
1fab9aca41
Fix #10701 - Broken link in documentation of randomUUID (#10702)
Arguments to DDoc macros must be separated by a comma and at most one
space, not spread over multiple lines.
2025-03-21 04:24:23 +08:00
Paul Backus
d4c9efef15
Merge pull request #10700 from ibuclaw/numeric_ieee_link
std.numeric: Fix IEEE typo in link
2025-03-20 13:44:18 -04:00
Iain Buclaw
0f3185e954 std.numeric: Fix IEEE typo in link 2025-03-20 15:11:25 +01:00
Paul Backus
96ab2077c3
Merge pull request #10694 from ntrel/template-of-void
std.traits.TemplateOf doesn't return void for non-template functions
2025-03-19 13:46:51 -04:00
Nick Treleaven
2ceb13ed44 std.traits.TemplateOf doesn't return void for non-template functions #10527 2025-03-19 14:47:43 +00:00
Inkrementator
67afde4f10
Fix #9585 Add check variant alignment (#10690)
* Fix #9585 Add check `variant` alignment

There has been code that handles alignment for a long time
now, and while this module is unlikely to be touched anymore, create a
regression test so the issue can be closed.

* Apparently double is 32bit aligned on x86
2025-03-19 12:20:30 +08:00
Inkrementator
c79914db2d
Fix #10440 Use right template constraint for each (#10689)
The current contraints have been implemented in #3837 to make `each`
behave more like `foreach` and automatically destructure tuples.

I haven't publically documented this behavior because it is probably
better these days to use `bind` for that.
2025-03-19 07:14:17 +08:00
The Dlang Bot
56f8c64df4
Merge pull request #10686 from Inkrementator/hypot_complex_abs_fixes
Unify abs(Complex!T) and hypot

Signed-off-by: Iain Buclaw <ibuclaw@users.noreply.github.com>
Merged-on-behalf-of: Iain Buclaw <ibuclaw@users.noreply.github.com>
2025-03-18 13:35:41 +01:00
Inkrementator
5329c10555 Optimization: Use u*u over u^^2 for better inlining 2025-03-18 00:19:13 +01:00
Inkrementator
006b1ca936 Logic: Move (huge,tiny) test up, supersedes testing for 0.0 2025-03-18 00:19:11 +01:00
Steven Schveighoffer
79cbde1ab6
Fix #10680 - Instead of passing receiver into the conversion function, (#10684)
just return the value and assign it to the receiver. Renamed the
conversion function and also cleaned up all the `typeof` calls, which
were very verbose.
2025-03-18 06:38:36 +08:00
gulugulubing
e8a7280b5d
Remove outdated @safe bug entry from toDelegate documentation (#10672) 2025-03-18 06:36:21 +08:00
Elias Batek
b150fde4da
Improve the situation with #9881 - Use unpredictableSeed in randomUUID() (#10671) 2025-03-17 15:10:26 -07:00
Inkrementator
da127b18b8 Add regression test for #10491 2025-03-17 22:40:33 +01:00
Inkrementator
63ce5c37c0 Optimization: Move NaN-check inside branch where it is guaranteed to happen 2025-03-17 22:40:33 +01:00
Inkrementator
91aa5feead Unify hypot and abs of complex values
This ports the fixes from abs(T)(ComplexT) regarding NaN and skipping
potentially inaccuracy inducing mathematical no-ops when one arg is 0 to
hypot. Both functions do the same thing and should be deduplicated.
hypot also has some logic regarding under and overflows, and while I
don't fully understand it, it should probably not be removed for complex
numbers.
2025-03-17 22:40:31 +01:00
Martin Kinkelin
cafe864533
std.json: Avoid setting union members, set the whole union instead (#10683)
To work around https://github.com/dlang/dmd/issues/20675.
2025-03-17 22:24:14 +08:00
Aditya Chincholkar
e1d9d0208b
Fix issue #10491 Complex!float.abs / hypot invalid result when argument is small (#10679) 2025-03-17 22:18:39 +08:00
Aditya Chincholkar
fd4979ab99
Fix issue #9829 std.conv.parse!(int, string) counts when doCount is false (#10674) 2025-03-17 22:15:40 +08:00
Aditya Chincholkar
271ae6219d
Fix #10577 - [std.math] std.math.algebraic.cbrt is not pure (#10670) 2025-03-16 07:24:13 +08:00
Elias Batek
13279b8594
Add additional tests to std.conv (#10673) 2025-03-15 16:28:45 +08:00
Elias Batek
264618e838
Cleanup DirIteratorImpl.__ctor (#10668) 2025-03-15 08:41:33 +08:00
Elias Batek
1e70ab9301
Remove range support from DirIteratorImpl.__ctor (#10667)
Was unused, untested and potentially broken.
2025-03-13 15:56:08 +08:00