← Back to index
|
Original Bugzilla link
Bug 18470 – std.algorithm.splitter has frame access problems for custom preds
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-02-19T19:27:19Z
Last change time
2020-03-21T03:56:32Z
Keywords
pull
Assigned to
No Owner
Creator
Seb
Comments
Comment #0
by greensunny12 — 2018-02-19T19:27:19Z
This isn't an issue for the string binaryFuns as used in the examples, but their lambda variants fail: --- void main() { import std.algorithm; auto w = [[0], [1], [2]]; assert(w.splitter!"a.front == b"(1).equal([[[0]], [[2]]])); assert(w.splitter!((a, b) => a.front == b)(1).equal([[[0]], [[2]]])); // fails } --- --- onlineapp.d(8): Error: template std.algorithm.iteration.splitter cannot deduce function from argument types !((a, b) => a.front == b)(int[][], int), candidates are: /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(3695): std.algorithm.iteration.splitter(alias pred = "a == b", Range, Separator)(Range r, Separator s) if (is(typeof(binaryFun!pred(r.front, s)) : bool) && (hasSlicing!Range && hasLength!Range || isNarrowString!Range)) /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(4000): std.algorithm.iteration.splitter(alias pred = "a == b", Range, Separator)(Range r, Separator s) if (is(typeof(binaryFun!pred(r.front, s.front)) : bool) && (hasSlicing!Range || isNarrowString!Range) && isForwardRange!Separator && (hasLength!Separator || isNarrowString!Separator)) /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(4264): std.algorithm.iteration.splitter(alias isTerminator, Range)(Range input) if (isForwardRange!Range && is(typeof(unaryFun!isTerminator(input.front)))) /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(4510): std.algorithm.iteration.splitter(C)(C[] s) if (isSomeChar!C) ---- --- void main() { import std.algorithm; import std.ascii : toLower; assert("abXcdxef".splitter!"a.toLower == b"('x').equal(["ab", "cd", "ef"])); assert("abXcdxef".splitter!((a, b) => a.toLower == b)('x').equal(["ab", "cd", "ef"])); } --- --- /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(3726): Error: static function onlineapp.main.splitter!((a, b) => a.toLower == b, string, char).splitter.Result.lastIndexOf cannot access frame of function D main /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(3764): Error: function onlineapp.main.splitter!((a, b) => a.toLower == b, string, char).splitter.Result.front cannot access frame of function D main onlineapp.d(8): Error: template instance onlineapp.main.splitter!((a, b) => a.toLower == b, string, char) error instantiating ---
Comment #1
by b2.temp — 2018-05-26T03:08:58Z
Pull :
https://github.com/dlang/phobos/pull/6522
Comment #2
by github-bugzilla — 2018-06-05T18:25:26Z
Commits pushed to master at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/b5162ecc014a33b5866f2de62b5af012cf425c1d
fix issue 18470 - std.algorithm.splitter has frame access problems for custom preds
https://github.com/dlang/phobos/commit/a6bf2b6c4793f6af9f6aa148f6bf603b702fb942
Merge pull request #6522 from BBasile/issue-18470 fix issue 18470 - std.algorithm.splitter has frame access problems for custom preds merged-on-behalf-of: Jack Stouffer <
[email protected]
>