Bug 19023 – findSplitBefore and findSplitAfter give wrong bool result

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-06-24T20:57:07Z
Last change time
2018-06-30T20:08:21Z
Keywords
pull
Assigned to
ag0aep6g
Creator
ag0aep6g

Comments

Comment #0 by ag0aep6g — 2018-06-24T20:57:07Z
Found while looking into issue 19020. The results of findSplit, findSplitBefore, and findSplitAfter are all supposed to convert to "true when the separating needle was found" [1]. But only findSplit actually does. The other two misbehave: ---- import std.algorithm.searching: findSplitBefore, findSplitAfter; void main() { assert(![1, 2, 3].findSplitBefore([4])); /* fails; should pass */ assert(![1, 2, 3].findSplitAfter([4])); /* fails; should pass */ } ---- [1] https://dlang.org/phobos/std_algorithm_searching.html#.findSplit
Comment #1 by ag0aep6g — 2018-06-24T21:16:43Z
Comment #2 by github-bugzilla — 2018-06-30T20:08:20Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/0b8f2030416c92a52afcde39ac5a4664ada60da1 fix issue 19023 - findSplitBefore and findSplitAfter give wrong bool result https://github.com/dlang/phobos/commit/3c1a43e587078e4fb68bff06026ceb6f72c7d623 Merge pull request #6608 from aG0aep6G/findSplit fix findSplit and friends (issues 19020, 19023)