D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20554 - std.algorithm.searching.all 's static assert produces a garbled error message
Summary: std.algorithm.searching.all 's static assert produces a garbled error message
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 trivial
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-02-01 08:51 UTC by mipri
Modified: 2021-09-22 08:12 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description mipri 2020-02-01 08:51:53 UTC
This invocation of rdmd:

rdmd --eval '"hi".all!isWhite'

yields this error message:

/usr/include/dmd/phobos/std/algorithm/searching.d(125): Error: static assert:  "sWhit isn't a unary predicate function for range.front"

which complains about 'sWhit' instead of 'isWhite'.

This happens due to

        static assert(is(typeof(unaryFun!pred(range.front))),
                "`" ~ pred.stringof[1..$-1] ~ "` isn't a unary predicate function for range.front");

which assumes that pred is a string whose .stringof needs to be stripped of double quotes.
Comment 1 Dlang Bot 2021-09-18 06:07:20 UTC
@jrfondren created dlang/phobos pull request #8246 "Fix issue 20554 - std.algorithm.searching.all 's static assert produc…" fixing this issue:

- Fix issue 20554 - std.algorithm.searching.all 's static assert produces a garbled error message

https://github.com/dlang/phobos/pull/8246
Comment 2 Dlang Bot 2021-09-22 08:12:00 UTC
dlang/phobos pull request #8246 "Fix issue 20554 - std.algorithm.searching.all 's static assert produc…" was merged into master:

- dc2bf7901f0c5ba06f16ef7dd5927908cf782368 by Julian Fondren:
  Fix issue 20554 - std.algorithm.searching.all 's static assert produces a garbled error message

https://github.com/dlang/phobos/pull/8246