The following reduced code used to work with 2.072.2:
import std.stdio : writeln;
import std.regex : ctRegex, matchAll, regex, splitter;
import std.algorithm : joiner, map;
string message = "fix issue 16319 and fix std.traits.isInnerClass";
static auto matchToRefs(M)(M m)
{
enum splitRE = regex(`[^\d]+`); // ctRegex throws a weird error in unittest compilation
return m.captures[5].splitter(splitRE);
}
// see https://github.com/github/github-services/blob/2e886f407696261bd5adfc99b16d36d5e7b50241/lib/services/bugzilla.rb#L155
enum issueRE = ctRegex!(`((close|fix|address)e?(s|d)? )?(ticket|bug|tracker item|issue)s?:? *([\d ,\+&#and]+)`, "i");
message.matchAll(issueRE).map!matchToRefs.joiner.writeln;
it fails with:
dlang/phobos/std/algorithm/iteration.d(2446): Error: cannot modify struct copy._items MapResult!(matchToRefs, RegexMatch!(string, BacktrackingMatcher)) with immutable members
dlang/phobos/std/algorithm/iteration.d(2443): Error: function std.algorithm.iteration.joiner!(MapResult!(matchToRefs, RegexMatch!(string, BacktrackingMatcher))).joiner.Result.save no return exp; or assert(0); at end of function
bugzilla.d(16): Error: template instance std.algorithm.iteration.joiner!(MapResult!(matchToRefs, RegexMatch!(string, BacktrackingMatcher))) error instantiating
According to digger this is due to:
https://github.com/dlang/phobos/pull/4286
cat > bug.d << CODE
import std.algorithm : joiner, map;
auto matchIssueRefs(string message)
{
import std.regex;
return message.matchAll(`a|b`).joiner;
}
void getIssueRefs(string[] messages)
{
messages.map!(m => m.matchIssueRefs).joiner;
}
CODE
dmd -c -o- bug
----
/usr/include/dmd/phobos/std/algorithm/iteration.d-mixin-2442(2456): Error: cannot modify struct this._current Result with immutable members
bug.d(11): Error: template instance std.algorithm.iteration.joiner!(MapResult!(__lambda2, string[])) error instantiating
----
Thanks for the fix, but it only seems to solves half of the problem, still getting this error with a nested `joiner`.